3

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'
4

1 回答 1

1

你不是碰巧通过限制 ssh 访问/etc/ssh/sshd_config吗?

我有类似的问题, git:check 失败,原因如下:

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-开始/ )

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

于 2014-05-31T13:05:45.903 回答