Capistrano deployment from Windows using forward_agent option: “Error reading response length from authentication socket.”

你离开我真会死。 提交于 2019-12-21 03:42:31

问题


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 git@github.com: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 git@github.com: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 git@github.com 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.


回答1:


This is a bug from net-ssh as described here



来源:https://stackoverflow.com/questions/10123896/capistrano-deployment-from-windows-using-forward-agent-option-error-reading-re

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!