简体   繁体   English

capistrano ssh代理转发 - 权限被拒绝(publickey)

[英]capistrano ssh agent forwarding - Permission denied (publickey)

agent forwarding is not working for an old repo, but it works for other repos/servers. 代理转发不适用于旧的仓库,但它适用于其他仓库/服务器。 I'm a collaborator of the repo on Github so I should be able to deploy: 我是Github上的repo的合作者,所以我应该可以部署:

bundle exec cap production deploy

However, I get: 但是,我得到:

DEBUG [4639b372] Command: cd /home/deploy/apps/xxx/repo && ( RBENV_ROOT=/usr/local/rbenv RBENV_VERSION=1.9.3-p286 GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/xxx/git-ssh.sh /usr/bin/env git remote update )
DEBUG [4639b372]    Fetching origin
DEBUG [4639b372]    Permission denied (publickey).
DEBUG [4639b372]    fatal: The remote end hung up unexpectedly
DEBUG [4639b372]    error: Could not fetch origin
cap aborted!
Exception while executing as xxx@xxx.xxx: git exit status: 1
git stdout: Fetching origin
git stderr: Permission denied (publickey).
fatal: The remote end hung up unexpectedly
error: Could not fetch origin
/Users/hector/.rvm/gems/ruby-2.1.2/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:16:in `rescue in block (2 levels) in execute'
/Users/hector/.rvm/gems/ruby-2.1.2/gems/sshkit-1.7.1/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => git:create_release => git:update
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Runner::ExecuteError: Exception while executing as xxx@xxx.xxx: git exit status: 1
git stdout: Fetching origin
git stderr: Permission denied (publickey).
fatal: The remote end hung up unexpectedly
error: Could not fetch origin

This is my deploy.rb: 这是我的deploy.rb:

set :application, 'xxx'
set :deploy_user, 'xxx'

# setup repo details
set :scm, :git
set :repo_url, 'git@github.com:xxx/xxx.git'

# setup rvm.
set :rbenv_type, :system
set :rbenv_ruby, '1.9.3-p286'
set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec"
set :rbenv_map_bins, %w{rake gem bundle ruby rails}

# how many old releases do we want to keep, not much
set :keep_releases, 5

# files we want symlinking to specific entries in shared
set :linked_files, %w{config/database.yml config/xxx.yml config/yetting.yml}

# dirs we want symlinking to shared
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

# what specs should be run before deployment is allowed to
# continue, see lib/capistrano/tasks/run_tests.cap
set :tests, [xxx]

set(:config_files, %w(
    xxx.xxx
  ))

set(:executable_config_files, %w(
    unicorn_init.sh
  ))


namespace :deploy do
  # make sure we're deploying what we think we're deploying
  before :deploy, "deploy:check_revision"
  before :deploy, "deploy:run_tests"
  after 'deploy:symlink:shared', 'deploy:compile_assets_locally'
  after :finishing, 'deploy:cleanup'
  after 'deploy:cleanup', 'airbrake:notify'

end

I'm using capistrano 3.2.1 in Mac OS 10.10.1 我在Mac OS 10.10.1中使用capistrano 3.2.1

Any idea why I get Permission denied (publickey)? 知道我为什么得到权限被拒绝(publickey)?

Thank you! 谢谢!

问题是回购已经改变,旧的缓存回购必须被删除。

rm -rf repo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM