2014-02-16 62 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 }
相關問題