Adam
Adam

Reputation: 56

Capistrano Cold Start - problems with git:check

cap staging git:check is failing after following the capistrano installation procedure ssh with -A option works fine, but not using the 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://[email protected]: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://[email protected]: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).

Environment: Capistrano 3.1 with Rails 4.0.2 and Ruby 2.0.0p353

cap staging forwarding result:

$ 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

And I can do the requested operation manually...

$ ssh -p 8888 -A deploy@my_domain.com 'git ls-remote ssh://[email protected]:8889/my_project/my_project.git'
0056e931836c18a22055d370deb3967aefb1f4fb        HEAD
0056e931836c18a22055d370deb3967aefb1f4fb        refs/heads/master

My best guess is that it isnt using the ssh -A option for some reason?? Thank you so much for your time, hopefully can get this solved as I would love to use capistrano for my deployments!

deploy.rb Settings:

lock '3.1.0'
set :application, 'my_project'
set :repo_url, 'ssh://[email protected]: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 settings

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'

Upvotes: 3

Views: 1794

Answers (1)

Extrapolator
Extrapolator

Reputation: 794

Don't you happen to restrict ssh access via /etc/ssh/sshd_config ?

I had similar problem, git:check failed with the following:

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

It turned out that git:check uploads git-ssh.sh to /tmp/project_name and runs the following command on the server: git ls-remote -h [email protected]:/opt/git/project_name (as said on this page: http://capistranorb.com/documentation/getting-started/cold-start/ )

In my case, the git repository and deployment server is on the same server, and ssh connections were allowed only from my ip, so I've just added AllowUsers git@localhost to /etc/ssh/sshd_config and it helped.

Upvotes: 1

Related Questions