简体   繁体   English

Rails - AWS (Elastic Beanstalk) 部署,错误命令“git clone”

[英]Rails - AWS (Elastic Beanstalk) deployment, Error Command 'git clone'

Trying to bundle install a gem from github (The author has not updated the gem on rubygems.org for whatever reason...) in AWS Elastic Beanstalk but I receive the following error:尝试在 AWS Elastic Beanstalk 中从 github 捆绑安装 gem(无论出于何种原因,作者都没有在 ruby​​gems.org 上更新 gem...),但我收到以下错误:

Command failed on instance. R
         (TRUNCATED)...nd `git clone "https://github.com/Diego81/omnicontacts.git"

Here's the code in my gemfile这是我的 gemfile 中的代码

gem 'omnicontacts', git: "https://github.com/Diego81/omnicontacts.git"

Other things i've tried...我尝试过的其他事情...

gem 'omnicontacts', git: "git://github.com/Diego81/omnicontacts.git"

gem 'omnicontacts', github: "Diego81/omnicontacts"

Still the same error with everything I've tried.我尝试过的一切仍然是同样的错误。 I've also tried this with other gems and I receive the same error.我也用其他宝石试过这个,我收到了同样的错误。 I should also note, this works perfectly on my local machine, it seems to be an issue with Elastic Beanstalk.我还应该注意,这在我的本地机器上运行良好,这似乎是 Elastic Beanstalk 的问题。

Ok I solved this by installing git on my EC2 instance.好的,我通过在我的 EC2 实例上安装 git 解决了这个问题。 Just ssh into your instance and run the following:只需通过 ssh 进入您的实例并运行以下命令:

sudo yum install git

and that should fix the problem.这应该可以解决问题。

I prefer this answer which adds Git to .ebextensions .我更喜欢这个将 Git 添加到.ebextensions答案 That way if I have eg a production server and a staging server, I don't have to separately SSH into both, I can just deploy to each and Git will be installed automatically.这样,如果我有一个生产服务器和一个登台服务器,我就不必分别通过 SSH 连接到两者,我可以只部署到每个服务器,Git 将自动安装。

The ebextensions approach also seems more durable. ebextensions方法似乎也更持久。 If for some reason I need to spin up a new server instance in the future, I'd rather have the configuration saved as code than have to remember what the configuration is supposed to be and then manually implement the configuration.如果由于某种原因我需要在未来启动一个新的服务器实例,我宁愿将配置保存为代码,而不是必须记住配置应该是什么,然后手动实现配置。

I was able to get what I needed by creating a file called .ebextensions/ruby.config with the following content:通过使用以下内容创建一个名为.ebextensions/ruby.config的文件,我能够获得所需的内容:

packages:
  yum:
    git: []

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM