我们有一个在Amazon AWS上运行的Rails应用程序。我们几乎每天都会推出一个新代码,连续几个月。
今天,当我尝试在那里部署新代码时,我收到了以下错误消息:
* 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 git@bitbucket.org: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 git@bitbucket.org: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 deployer@IP)
connection failed for: IP (Net::SSH::AuthenticationFailed: Authentication failed for user deployer@IP)
这里发生了什么?从哪里开始寻找问题?
答案 0 :(得分:23)
问题是宝石
净-SSH
最后一个版本(2.8.0)导致此问题。解决方案是卸载它:
gem uninstall net-ssh -v 2.8.0
然后将Gemfile添加到以前的版本中:
gem "net-ssh", "~> 2.7.0"
就是这样。
答案 1 :(得分:10)
使用capistrano部署时遇到了同样的问题 Net :: SSH :: AuthenticationFailed:用户部署者@ IP
的身份验证失败ssh-copy-id deployer@ip
这会将您的密钥添加到服务器,您无需密码即可登录。
答案 2 :(得分:0)
卸载net-ssh 2.8.0后,也删除gemfile.lock。它会一直没问题。
答案 3 :(得分:0)
请删除旧的net-ssh并安装如下更新,将其添加到您的gem文件中,或者可以在指定2.9.2版本的环境中安装它。
gem 'net-ssh', '~> 2.9.2'
它适用于我。
答案 4 :(得分:0)
对于deploy.rb中的capistrano2
:ssh_options, { config: false}
:ssh_options, { config: false, number_of_password_prompts: 0 }