使用forward_agent选项从Windows进行Capistrano部署:“从身份验证套接字读取响应长度时出错". [英] Capistrano deployment from Windows using forward_agent option: "Error reading response length from authentication socket."

查看:187
本文介绍了使用forward_agent选项从Windows进行Capistrano部署:“从身份验证套接字读取响应长度时出错".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Capistrano部署项目.我的开发机器运行的是Windows 7;我要部署到的服务器是Linux.

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

在deploy.rb脚本中,设置了以下内容:

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

ssh_options[:forward_agent] = true

Capistrano脚本通过在本地运行git命令开始,这时,系统提示我输入SSH密钥的密码:

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

(您可能已经看到,我已经从上面删除了实际的git路径.)

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

我输入了密码,这可以正常工作.但是,Capistrano然后尝试在远程计算机上做类似的事情(在下面重命名为staging-server.com),我得到一个错误-请参阅此摘录的最后一行:

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.

如果我注释了deploy.rb中的forward_agent行,则表明安装成功,大概使用了部署服务器本身的密钥.

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

我的SSH密钥似乎可以正常工作-毕竟,最初的git命令有效,我可以在git push/pull和ssh中使用它-T git@github.com报告应该执行的操作(如github:help ).

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).

我假设远程服务器要求我的机器不提供密钥时.经过大量的Google搜索之后,我在 http:上找到了建议://hustoknow.blogspot.co.uk/2011/06/ssh-agent-and-agent-forwarding-on.html ,其中介绍了如何使ssh-agent在启动时运行.我是从命令提示符执行所有操作的,因此我切换到git-bash并为此设置了.bash_profile,以包括我链接到的脚本.

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.

添加此内容后,首次启动git bash时提示我输入密码短语,然后可以使用SSH密钥连接到github(而不必重新输入密码短语).此外,ssh-add -L报告确实存在可用的密钥.因此,一切似乎都已正确设置!

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.

有什么想法吗?这适用于我的开发机器是Linux的同事(相同的deploy.rb文件).

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

推荐答案

这是来自net-ssh的错误,为在此描述

This is a bug from net-ssh as described here

这篇关于使用forward_agent选项从Windows进行Capistrano部署:“从身份验证套接字读取响应长度时出错".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆