0

是否可以在 openshift 上从 github 安装 gem?我的 Gemfile 包含以下内容:

gem 'rails3-jquery-autocomplete', git: 'git@github.com:/francisd/rails3-jquery-autocomplete.git'

将其推送到 openshift 后,我​​收到以下错误:

remote: Bundling RubyGems based on Gemfile/Gemfile.lock to repo/vendor/bundle with 'bundle install --deployment'
remote: Fetching gem metadata from https://rubygems.org/.........
remote: Fetching gem metadata from https://rubygems.org/..
remote: Fetching git@github.com:/francisd/rails3-jquery-autocomplete.git
remote: Host key verification failed.
remote: fatal: Could not read from remote repository.
remote: 
remote: Please make sure you have the correct access rights
remote: and the repository exists.
remote: Git error: command `git clone 'git@github.com:/francisd/rails3-jquery-autocomplete.git' "/var/lib/openshift/524352534a050e34/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/cache/bundler/git/rails3-jquery-autocomplete-478b4e668116f8a9987a8288cfe611825d6577a8" --bare --no-hardlinks` in directory /var/lib/openshift/524352534a050e34/app-root/runtime/repo has failed.
remote: An error occurred executing 'gear postreceive' (exit code: 11)
remote: Error message: Failed to execute: 'control build' for /var/lib/openshift/524352534a050e34/ruby
remote: 
remote: For more details about the problem, try running the command again with the '--trace' option.

在 ssh 登录并运行“RAILS_ENV=production bundle install”后:

[thankz-snusmu.rhcloud.com repo]\> RAILS_ENV=production bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Fetching git@github.com:/francisd/rails3-jquery-autocomplete.git
The authenticity of host 'github.com (192.30.252.131)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/var/lib/openshift/524352534a050e34/.ssh/known_hosts).
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Git error: command `git clone 'git@github.com:/francisd/rails3-jquery-autocomplete.git' "/var/lib/openshift/524352534a050e34/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/cache/bundler/git/rails3-jquery-autocomplete-478b4e668116f8a9987a8288cfe611825d6577a8" --bare --no-hardlinks` in directory /var/lib/openshift/524352534a050e34/app-root/runtime/repo has failed.

然后我按照https://www.openshift.com/forums/openshift/failed-to-add-the-host-to-the-list-of-known-hosts-on-openshift-itself中描述的步骤修复 known_hosts访问问题

[thankz-snusmu.rhcloud.com repo]\> mkdir -p $OPENSHIFT_DATA_DIR/.ssh/ 
[thankz-snusmu.rhcloud.com repo]\> echo -e "#\041/bin/sh\n/usr/bin/ssh -o \"UserKnownHostsFile=$OPENSHIFT_DATA_DIR/.ssh/known_hosts\" \"\$@\"" > $OPENSHIFT_DATA_DIR/my_ssh_wrapper 
[thankz-snusmu.rhcloud.com repo]\> chmod +x  $OPENSHIFT_DATA_DIR/my_ssh_wrapper
[thankz-snusmu.rhcloud.com repo]\> export GIT_SSH=$OPENSHIFT_DATA_DIR/my_ssh_wrapper

但是,我仍然收到类似的错误...

[thankz-snusmu.rhcloud.com repo]\> git clone 'git@github.com:/francisd/rails3-jquery-autocomplete.git' "/var/lib/openshift/524352534a050e34/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/cache/bundler/git/rails3-jquery-autocomplete-478b4e668116f8a9987a8288cfe611825d6577a8" --bare --no-hardlinks
Cloning into bare repository '/var/lib/openshift/524352534a050e34/app-root/runtime/repo/vendor/bundle/ruby/1.9.1/cache/bundler/git/rails3-jquery-autocomplete-478b4e668116f8a9987a8288cfe611825d6577a8'...
Warning: Permanently added the RSA host key for IP address '192.30.252.131' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
4

1 回答 1

0

我发现的一个选择是将 gem 冻结到我的 rails 应用程序中。

  1. mkdir -p 供应商/宝石 && cd 供应商/宝石/
  2. git clone git@github.com:/francisd/rails3-jquery-autocomplete.git
  3. 将 Gemfile 设置为包含:

    gem 'rails3-jquery-autocomplete',路径:'vendor/gems/rails3-jquery-autocomplete'

  4. cd ../../ && 捆绑安装

于 2013-09-18T16:33:06.353 回答