git - capistrano ssh 代理转发 - 权限被拒绝(公钥)

标签 git github ssh capistrano capistrano3

代理转发不适用于旧的仓库,但它适用于其他仓库/服务器。我是 Github 上 repo 的合作者,所以我应该能够部署:

bundle exec cap production deploy

但是,我得到:

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

这是我的 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

我在 Mac OS 10.10.1 中使用 capistrano 3.2.1

知道为什么我得到 Permission denied (publickey) 吗?

谢谢!

最佳答案

问题是存储库已更改,必须删除旧的缓存存储库。

rm -rf repo

关于git - capistrano ssh 代理转发 - 权限被拒绝(公钥),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29852489/

相关文章:

windows - 在未连接的计算机上使用 git

git - 如何在本地测试来自 GitLab 的 pull 请求?

git - Git .ssh 的默认路径是什么?

git - .gitignore 是什么?

python - 如何使用 Python 生成 SSH key 对

linux - 通过 SSH 将一个文件夹 tar 成多个文件

Git:如何执行硬推送

python - virtualenvwrapper 的问题

Git for Windows Bash shell 'less' 命令在显示来自 Git 日志调用的格式化文本时显示垃圾

version-control - 什么以及如何对 Github 上的文本编辑器(Sublime Text)设置进行版本控制,以便在任何机器上都可以随时使用这些设置进行编码?