Capistrano deployment from Windows using forward_agent option: "Error reading response length from authentication socket."
Asked Answered
U

1

12

I'm trying to deploy a project using Capistrano. My development machine is running Windows 7; the server I'm deploying onto is Linux.

In the deploy.rb script, the following is set:

ssh_options[:forward_agent] = true

The Capistrano script starts off by running a git command locally, at which point I'm prompted for the passphrase for my SSH key:

* executing `deploy:update_code'
executing locally: "git ls-remote [email protected]:pathto/gitproject.git develop"
Enter passphrase for key '/c/Users/Sam/.ssh/id_rsa':
command finished in 6999ms

(I've removed the real git path from the above as you can probably see.)

I enter my passphrase and this works fine. However, Capistrano then tries to do something similar on the remote machine (renamed to staging-server.com in the below) and I get an error -- see the final line of this extract:

[staging-server.com] executing command
[staging-server.com] sh -c 'git clone [email protected]:pathto/gitproject.git /home/perstest/releases/20120412074500 && cd
/home/perstest/releases/20120412074500 && git checkout -b deploy 50eaf06d06d66fd20c3e55038276f420d8c308a8 && (echo 50eaf06d06d66fd20c3e55038
276f420d8c308a8 > /home/perstest/releases/20120412074500/REVISION)'
 ** [staging-server.com :: out] Initialized empty Git repository in /home/perstest/releases/20120412074500/.git/
 ** [staging-server.com :: err] Error reading response length from authentication socket.

If I comment out the forward_agent line in deploy.rb, this install succeeds, presumably using the key from the deployment server itself.

My SSH key seems to be working - after all, the initial git command works, I can use it in git push/pull and ssh -T [email protected] reports what it should (as recommended on github:help).

I assumed that my machine was not serving keys when asked for them by the remote server. After an awful lot of Googling, I found the recommendations at http://hustoknow.blogspot.co.uk/2011/06/ssh-agent-and-agent-forwarding-on.html, which explain how to get ssh-agent running on startup. I was doing all this from the command-prompt, so I then switched to git-bash and set up my .bash_profile for that to include the script I've linked to.

After adding this, I was prompted for my passphrase when first launching git bash and I could then connect to github using the SSH key (without having to re-enter passphrase). Furthermore, ssh-add -L reported that there was indeed a key available. So everything seems to be set up correctly!

However, I still get the "Error reading response length from authentication socket." error.

Any ideas? This works for my colleague (same deploy.rb file) whose development machine is Linux.

Useful answered 12/4, 2012 at 12:49 Comment(1)
I've the exact issue with a coworker attempting to deploy from windows. Works fine for me in Mac OS X 10.7Dwyer
I
4

This is a bug from net-ssh as described here

Infestation answered 16/8, 2012 at 11:40 Comment(2)
I'm not sure if the error described on that page is exactly the same as the one I'm seeing - the error messages are different. However, that page does reference a filed issue about agent forwarding and Windows, so if that ever gets fixed it'll probably sort things for my situation too even though the specific error differs. I've actually switched to Linux now (for other reasons), so that's one way of solving the problem ;-)Useful
Apparently it's fixed now: Fixed pageant supportEctype

© 2022 - 2024 — McMap. All rights reserved.