在openshift上从git源安装gem

时间:2013-09-18 15:47:46

标签: git github ssh openshift

可以在openshift上从github安装gems吗? 我的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.

1 个答案:

答案 0 :(得分:0)

我找到的一个选项是将一个宝石冻结到我的rails应用程序中。

  1. mkdir -p vendor / gems&& cd vendor / gems /
  2. git clone git@github.com:/francisd/rails3-jquery-autocomplete.git
  3. 将Gemfile设置为包含:

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

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