cap staging git:check在使用 -A 选项执行 capistrano 安装过程 ssh 后失败,但不使用 git:check。
http://capistranorb.com/documentation/getting-started/cold-start/
$ cap staging git:check
DL is deprecated, please use Fiddle
INFO [f06698cd] Running /usr/bin/env mkdir -p /tmp/my_project/ on my_domain.com
DEBUG [f06698cd] Command: /usr/bin/env mkdir -p /tmp/my_project/
INFO [f06698cd] Finished in 0.976 seconds with exit status 0 (successful).
DEBUG Uploading /tmp/my_project/git-ssh.sh 0.0%
INFO Uploading /tmp/my_project/git-ssh.sh 100.0%
INFO [296a196a] Running /usr/bin/env chmod +x /tmp/my_project/git-ssh.sh on my_domain.com
DEBUG [296a196a] Command: /usr/bin/env chmod +x /tmp/my_project/git-ssh.sh
INFO [296a196a] Finished in 0.181 seconds with exit status 0 (successful).
DEBUG [063672c2] Running /usr/bin/env git ls-remote ssh://git@git-domain.com:8889/my_project/my_project.git on my_domain.com
DEBUG [063672c2] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/my_project/git-ssh.sh /usr/bin/env git ls-remote ssh://git@git-domain.com:8889/my_project/my_project.git )
DEBUG [063672c2] Error reading response length from authentication socket.
DEBUG [063672c2] Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
DEBUG [063672c2] fatal: Could not read from remote repository.
DEBUG [063672c2]
DEBUG [063672c2] Please make sure you have the correct access rights
DEBUG [063672c2] and the repository exists.
DEBUG [063672c2] Finished in 0.572 seconds with exit status 128 (failed).
环境:Capistrano 3.1,带有 Rails 4.0.2 和 Ruby 2.0.0p353
上限分期转发结果:
$ cap staging forwarding
DL is deprecated, please use Fiddle
DEBUG [92ef7d99] Running /usr/bin/env env | grep SSH_AUTH_SOCK on my_domain.com
DEBUG [92ef7d99] Command: env | grep SSH_AUTH_SOCK
DEBUG [92ef7d99] SSH_AUTH_SOCK=/tmp/ssh-RWvvKUq627/agent.627
DEBUG [92ef7d99] Finished in 1.843 seconds with exit status 0 (successful).
INFO Agent forwarding is up to my_domain.com
我可以手动执行请求的操作...
$ ssh -p 8888 -A deploy@my_domain.com 'git ls-remote ssh://git@git-domain.com:8889/my_project/my_project.git'
0056e931836c18a22055d370deb3967aefb1f4fb HEAD
0056e931836c18a22055d370deb3967aefb1f4fb refs/heads/master
我最好的猜测是由于某种原因它没有使用 ssh -A 选项?非常感谢您抽出宝贵时间,希望可以解决这个问题,因为我很想在我的部署中使用 capistrano!
deploy.rb 设置:
lock '3.1.0'
set :application, 'my_project'
set :repo_url, 'ssh://git@git-domain.com:8889/my_project/my_project.git'
set :ssh_options, {
forward_agent: true,
port: 8888
}
set :use_sudo, false # tried with and without this setting
set :branch, 'master'
staging.rb 设置
role :app, %w{deploy@my_domain.com}
role :web, %w{deploy@my_domain.com}
role :db, %w{deploy@my_domain.com}
server 'my_domain.com', user: 'deploy', roles: %w{web app db}, deploy_to: '/home/deploy/my_project_staging'