SSHKit :: Runner :: ExecuteError:在主机上执行时发生异常Net :: SSH :: AuthenticationFailed:身份验证失败

时间:2015-06-28 16:54:38

标签: git ruby-on-rails-4 ssh capistrano3

尝试使用Capistrano 3部署rails app,当我运行此命令时,会出现此错误

vagrant@vagrant-ubuntu-utopic-32:/vagrant$ cap production deploy
INFO [e4213f70] Running /usr/bin/env mkdir -p /tmp/career/ on 192.168.51.54
DEBUG [e4213f70] Command: /usr/bin/env mkdir -p /tmp/career/
Text will be echoed in the clear. Please install the HighLine or Termios librari
es to suppress echoed text.
@192.168.51.54's password:secert
@192.168.51.54's password:secert
@192.168.51.54's password:secert
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host 192.168.51.54: A
uthentication failed for user @192.168.51.54

Net::SSH::AuthenticationFailed: Authentication failed for user @192.168.51.54

Tasks: TOP => git:check => git:wrapper
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing on host 192.168.5
1.54: Authentication failed for user @192.168.51.54

我在堆栈溢出中看到了一些帖子[12]。但我仍然犯错误。

这是我的Capfile:

require 'capistrano/setup'
set :stage, :production
require 'capistrano/deploy'
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

deploy.rb文件:

lock '3.4.0'
set :application, "career"
set :repo_url, "https://github.com/mezbahalam/offender_profile"

set :user, 'vagrant'
# set :scm_passphrase, "password"
set :deploy_to, "/home/vagrant/apps/career"
set :use_sudo, false
set :scm, :git
server "192.168.51.54",  roles: [:app, :web, :db], :primary => true 
我错了什么?

1 个答案:

答案 0 :(得分:3)

尝试设置ssh密钥进行部署。确保您的公钥位于服务器上的授权密钥列表中,并且它是chmod 600。