我正在尝试根据此截屏视频为我的 Wordpress 设置进行 Capistrano 3 部署, 我正在部署到 ubuntu 12.04 服务器
所以这是我的 deploy.rb 文件:
set :application, 'dladv'
set :repo_url, 'git@bitbucket.org:username/repo.git'
set :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
set :deploy_via, :copy
set :deploy_to, '/var/www/php/domain' # I have set the correct permissions with www:data group and added stager as member of this group
set :log_level, :debug
set :pty, true
set :linked_dirs, %w{uploads}
# set :default_env, {}
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app) do
sudo "apache2ctl", "graceful", "-v"
end
end
end
我的staging.rb
样子是这样的:
set :stage, :staging
server 'staging.domain.com', user: 'stager', roles: %w{web app db}, port: 47
# set it globally
set :ssh_options, {
keys: %w(/home/stager/.ssh/id_rsa),
forward_agent: true,
auth_methods: %w(password)
}
现在,当我尝试做时cap staging deploy --trace
,我得到:
→ cap staging deploy --trace
** Invoke staging (first_time)
** Execute staging
** Invoke load:defaults (first_time)
** Execute load:defaults
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
** Invoke deploy (first_time)
** Execute deploy
** Invoke deploy:starting (first_time)
** Execute deploy:starting
** Invoke deploy:check (first_time)
** Execute deploy:check
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
INFO [217d8451] Running /usr/bin/env mkdir -p /tmp/dladv/ on staging.domain.com
DEBUG [217d8451] Command: /usr/bin/env mkdir -p /tmp/dladv/
cap aborted!
Authentication failed for user stager@staging.domain.com
/Users/amiterandole/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/net-ssh-2.8.0/lib/net/ssh.rb:217:in `start'
/Users/amiterandole/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/sshkit-1.3.0/lib/sshkit/backends/connection_pool.rb:25:in `create_or_reuse_connection'
/Users/amiterandole/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:173:in `ssh'
/Users/amiterandole/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:126:in `block in _execute'
/Users/amiterandole/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `tap'
/Users/amiterandole/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `_execute'
/Users/amiterandole/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/amiterandole/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/capistrano-3.0.1/lib/capistrano/tasks/git.rake:13:in `block (3 levels) in <top (required)>'
/Users/amiterandole/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/amiterandole/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/amiterandole/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/sshkit-1.3.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => git:check => git:wrapper
- 我已将我的 imac
ssh/id_ra.pub
密钥添加到服务器的authorized_keys
文件中,并且 - 我已经
ssh-keygen -t rsa -C "myemail@gmail.com"
在服务器上生成,然后将该密钥添加到我的 github 帐户和我的 bitbucket 帐户 - 我已经在服务器上使用 bitbucket 进行了验证
ssh -T hg@bitbucket.org
我不知道为什么它一直说Authentication failed for user stager@staging.domain.com
请帮助