2014-02-16 63 views
13

我们有一个在Amazon AWS上运行的Rails应用程序。我们几乎每天都会推出一个新代码,连续几个月。Capistrano无法部署代码,因为Net :: SSH :: AuthenticationFailed:身份验证失败

今天,当我试图在那里部署新的代码,我得到了这样的错误消息:

* 2014-02-16 13:09:51 executing `deploy' 
    * 2014-02-16 13:09:51 executing `deploy:update' 
** transaction: start 
    * 2014-02-16 13:09:51 executing `deploy:update_code' 
    updating the cached checkout on all servers 
    executing locally: "git ls-remote [email protected]:my_bitbucket_name/project_name.git master" 
    command finished in 2909ms 
    * executing "if [ -d /home/deployer/project_name/shared/cached-copy ]; then cd /home/deployer/project_name/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 16958dfcee27dd9c33855ecece0013428e2c57c8 && git clean -q -d -x -f; else git clone -q -b master [email protected]:rdudacz/looky.co.git /home/deployer/looky/shared/cached-copy && cd /home/deployer/project_name/shared/cached-copy && git checkout -q -b deploy 16958dfcee27dd9c33855ecece0013428e2c57c8; fi" 
    servers: ["IP"] 
*** [deploy:update_code] rolling back 
    * executing "rm -rf /home/deployer/project_name/releases/20140216120957; true" 
    servers: ["IP"] 
** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: IP (Net::SSH::AuthenticationFailed: Authentication failed for user [email protected]) 
connection failed for: IP (Net::SSH::AuthenticationFailed: Authentication failed for user [email protected]) 

这里发生了什么?从哪里开始寻找问题?

回答

23

的问题是创业板

net-ssh

的最后一个版本(2.8.0)会导致此问题。该解决方案是将其卸载:

gem uninstall net-ssh -v 2.8.0 

,然后添加到Gemfile中其以前的版本:

gem "net-ssh", "~> 2.7.0" 

就是这样。

+0

我'使用net-SSH 2.7。 0'和无密码登录工作正常,但仍然得到'Net :: SSH :: AuthenticationFailed' –

+1

谢谢你!看起来2.9也有一个问题,它无法通过端口22连接到服务器,而使用SSH工作正常。恢复到2.7作品! –

+0

我使用ruby-2.1.2p95,安装net-ssh 2.7.0之后,我得到这个错误:**/ruby​​-2.1.2/lib/ruby​​/2.1.0/ruby​​gems/dependency.rb:298:在'to_specs'中:找不到'net-ssh'(> = 2.8.0) - 找到了:[net-ssh-2.7.0](Gem :: LoadError) – aqingsao

0

卸载net-ssh 2.8.0之后,在gemfile.lock上删除。它会持续不错。

10

我有同样的问题,而使用Capistrano的 网络部署:: SSH :: AuthenticationFailed:身份验证失败,用户部署IP @

ssh-copy-id [email protected] 

这会将密钥添加到服务器,您可以不需要密码登录。

0

请删除旧的net-ssh并安装如下更新,将其添加到您的gem文件中或者可以将其安装在指定2.9.2版本的环境中。

gem 'net-ssh', '~> 2.9.2' 

它的作品适合我。

0

对于capistrano2在deploy.rb

  • 净SSH 2.9.1设置:ssh_options, { config: false}
  • 净SSH 2.9.2设置:ssh_options, { config: false, number_of_password_prompts: 0 }
相关问题