capistrano 3.2.1中的git身份验证错误

时间:2015-10-02 09:38:25

标签: git amazon-ec2 capistrano3 ruby-on-rails-4.1 ruby-2.1.3

我已将server_users rsa.pub密钥添加到git,我得到的错误是

Running /usr/bin/env git ls-remote -h http://git.example.com/nishant/pro-gasket.git on 52.24.70.121
DEBUG[c40f8fa6] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/pro-gasket/git-ssh.sh /usr/bin/env git ls-remote -h http://git.example.com/nishant/pro-gasket.git )
DEBUG[c40f8fa6]     fatal: Authentication failed for 'http://git.example.com/nishant/pro-gasket.git/'
DEBUG[c40f8fa6]     
DEBUG[c40f8fa6] Finished in 1.549 seconds with exit status 128 (failed).
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host 52.24.70.121: exit
/home/codebajra/.rvm/gems/ruby-2.1.3@pro-gasket/gems/capistrano-3.2.1/lib/capistrano/tasks/git.rake:28:in `exit'  

服务器中的git版本是1.9.1

2 个答案:

答案 0 :(得分:1)

由于服务器使用ssh连接到github,所以请使用repourl来获取ssh。

答案 1 :(得分:1)

除了 -

的基础知识
  • 确保git安装在远程主机上,
  • 确保失败的用户拥有存储库的权利

您可能遇到以下情况:您的部署刚刚停止工作,或者它们正在为某些用户而不是其他用户工作 - 即您知道远程主机设置正确。

在这种情况下,失败的用户可能没有在本地将SSH密钥添加到ssh代理 - 这是必需的,因为Capistrano使用SSH代理转发(即将本地ssh密钥转发到远程主机)。

要解决此问题,请确保您的代理正在(本地)运行,如下所示:

eval `ssh-agent -s`

然后添加密钥

ssh-add

确认您的身份已添加如下:

ssh-add -l