cap staging git:check and cap staging deploy cannot access GitHub but SSH session tests are OK

844 views
Skip to first unread message

Doug Lauver

unread,
Feb 17, 2014, 4:07:11 PM2/17/14
to capis...@googlegroups.com
I've seen other discussion about the differences between running in an SSH session and Capistrano (http://capistranorb.com/documentation/faq/why-does-something-work-in-my-ssh-session-but-not-in-capistrano/), but I haven't been able to figure out why Capistrano is not able to access GitHub from my remote server. I can access it fine using agent forwarding in a shell session (results below), and all the recommended SSH session tests pass. Any help is appreciated!

On the server, the .bash_profile file contains:

umask 002
PS1='[\h]$ '
export PATH=/usr/local/php54/bin:$PATH

The .bashrc file is empty.


Versions:
  • Ruby 1.9.3p231
  • Capistrano 3.1
  • Rake / Rails / etc
Platform:
  • Working on.... Windows
  • Deploying to... Linux 3.2.45-grsec-2.9.1-r3+ (shared host)
Logs:

(Sanitized)

Result of cap staging git:check

  [34mINFO [0m [ [32m3422c4a2 [0m] Running [33m [1m/usr/bin/env mkdir -p /home/username/tmp/capistrano/cap-win-clean/ [0m [0m on [34mkindofsocial.net [0m
[30mDEBUG [0m [ [32m3422c4a2 [0m] Command: [34m/usr/bin/env mkdir -p /home/username/tmp/capistrano/cap-win-clean/ [0m
  [34mINFO [0m [ [32m3422c4a2 [0m] Finished in 1.259 seconds with exit status 0 ( [1m [32msuccessful [0m [0m).
[30mDEBUG [0m Uploading /home/username/tmp/capistrano/cap-win-clean/git-ssh.sh 0.0%
  [34mINFO [0m Uploading /home/username/tmp/capistrano/cap-win-clean/git-ssh.sh 100.0%
  [34mINFO [0m [ [32m0f1968d4 [0m] Running [33m [1m/usr/bin/env chmod +x /home/username/tmp/capistrano/cap-win-clean/git-ssh.sh [0m [0m on [34mmyserver.com [0m
[30mDEBUG [0m [ [32m0f1968d4 [0m] Command: [34m/usr/bin/env chmod +x /home/username/tmp/capistrano/cap-win-clean/git-ssh.sh [0m
  [34mINFO [0m [ [32m0f1968d4 [0m] Finished in 0.245 seconds with exit status 0 ( [1m [32msuccessful [0m [0m).
[30mDEBUG [0m [ [32md1bedc90 [0m] Running [33m [1m/usr/bin/env git ls-remote g...@github.com:kosocial/cap-win-clean.git [0m [0m on [34mmyserver.com [0m
[30mDEBUG [0m [ [32md1bedc90 [0m] Command: [34m( GIT_ASKPASS=/bin/echo GIT_SSH=/home/username/tmp/capistrano/cap-win-clean/git-ssh.sh /usr/bin/env git ls-remote g...@github.com:kosocial/cap-win-clean.git ) [0m
[30mDEBUG [0m [ [32md1bedc90 [0m] [31m Error reading response length from authentication socket. [0m [30mDEBUG [0m [ [32md1bedc90 [0m] [31m Permission denied (publickey). [0m [30mDEBUG [0m [ [32md1bedc90 [0m] [31m fatal: The remote end hung up unexpectedly
[0m [30mDEBUG [0m [ [32md1bedc90 [0m] Finished in 1.190 seconds with exit status 128 ( [1m [31mfailed [0m [0m).


Result of SSH session agent forwarding connecting to github

ssh -A user...@myserver.com 'git ls-remote g...@github.com:kosocial/cap-win-clean.git'
2a98e472fbb5ce902eea90f4531146792aead6e9 HEAD
2a98e472fbb5ce902eea90f4531146792aead6e9 refs/heads/master

Files:
  • Capfile
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }

  • deploy.rb
lock '3.1.0'
set :application, 'cap-win-clean'
set :repo_url, 'g...@github.com:kosocial/cap-win-clean.git'

  • Stage files (production.rb, staging.rb)
staging.rb

server 'myserver.com', user: 'username', roles: :all
set :deploy_to, '/home/username/staging/cap-win-clean'
set :tmp_dir, '/home/user/tmp/capistrano'
set :ssh_options, {
  forward_agent: true
}

Lee Hambley

unread,
Feb 17, 2014, 4:13:28 PM2/17/14
to capistrano
A cursory Google search shows that this is a problem with the ssh agent (`Error reading response length from authentication socket.`), it might be an issue with Putty (no idea, haven't touched a windows PC since Macs have been made of Aluminium!) or with some versions of Net::SSH, you might try their Github issue tracker.

Capistrano (and by extension SSHKit) are just wrappers around Net::SSH, which should work on Windows, but has literally never been tested.

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/d77eb750-0e53-4e13-9fce-1efd99b6d53c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Doug Lauver

unread,
Feb 17, 2014, 4:31:55 PM2/17/14
to capis...@googlegroups.com
Thanks for your response. I thought I had solved the ssh agent issue since I got everything working consistently from the command line using msysgit instead of Putty. It's probably time for a Mac.

Doug

Lee Hambley

unread,
Feb 18, 2014, 1:22:27 AM2/18/14
to capistrano

Sorry Doug, I really wish I could be more help!

Sent from my Nexus 4.

Doug Lauver

unread,
Feb 18, 2014, 11:39:39 AM2/18/14
to capis...@googlegroups.com
I tried a different approach and got Capistrano working under Cygwin, so their handling of OpenSSH and Net::SSH must be different than the (several) native Windows applications that I tried. Now I can finally start learning Capistrano itself.

Everett Carney

unread,
Mar 6, 2014, 2:47:28 PM3/6/14
to capis...@googlegroups.com
I've been toying around with Capistrano 3 on Windows and ran into a bunch of authentication issues. I'm trying to avoid Cygwin because it puts a noticeable strain on the OS but that might be the only solution. Out of curiosity, did you try running things  through the command line, Powershell, GIT Bash, and Putty? I haven't had any luck with that but I'm very new to this kind of deployment method so I could be doing something wrong. I was hitting this:

C:\Sites\blog_app>cap production deploy:setup_config DL is deprecated, please use Fiddle DEBUG [6c7f43b1] Running /usr/bin/env [ ! -d /usr/local/rbenv/versions/2.0.0-p24 7 ] on dnsname.cloudapp.net DEBUG [6c7f43b1] Command: [ ! -d /usr/local/rbenv/versions/2.0.0-p247 ] cap aborted! Authentication failed for user user@dnsname.cloudapp.net

When I found this potential work-around but wasn't able to get it to work. If you have a minute to try it through the command line I'd be curios to see if you could get it up and running (without Cygwin)

set :ssh_options, { keys: ["#{ENV['USERPROFILE']}/.ssh/id_rsa.pub"] }


Doug Lauver

unread,
Mar 7, 2014, 9:11:37 AM3/7/14
to capis...@googlegroups.com
I went way down that road of trying various command line approaches. Once I got all the ssh-agent forwarding stuff working with the manual tests shown at http://capistranorb.com/documentation/getting-started/authentication-and-authorisation/ I thought I would be good to go, but it always failed under Capistrano. I'm thinking that there's a fundamental difference in the Ruby implementation for Windows itself, since I can get the identical configuration to work under Cygwin. I don't have the Windows environment set up any more to test your code.

About Cygwin, I installed the minimum number of packages, just the defaults plus Ruby and OpenSSH. I didn't install any Windows services, since they're not needed for deploying using Capistrano. Unless I'm missing something, the only time it uses any system resource (beside disk space) is when I'm running something from the Cygwin command line. I don't use it for my local testing environment.
Reply all
Reply to author
Forward
0 new messages