Capistrano冷启动 - git的问题:检查

时间:2014-01-17 01:32:00

标签: ruby-on-rails git capistrano capistrano3

上限git:检查 在执行capistrano安装程序后失败 ssh与-A选项正常,但不使用git :检查

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'

1 个答案:

答案 0 :(得分:1)

您是否碰巧通过/etc/ssh/sshd_config限制ssh访问?

我有类似的问题,git:检查失败,并带有以下内容:

DEBUG [0e6f1fac] Permission denied (publickey). DEBUG [0e6f1fac] fatal: Could not read from remote repository.

原来git:check将git-ssh.sh上传到/ tmp / project_name并在服务器上运行以下命令: git ls-remote -h git@domain.com:/opt/git/project_name (如本页所述:http://capistranorb.com/documentation/getting-started/cold-start/

就我而言,git存储库和部署服务器位于同一台服务器上,并且只允许来自我的ip的ssh连接,所以我刚刚将AllowUsers git@localhost添加到/etc/ssh/sshd_config并且它有所帮助。