从身份验证套接字读取响应长度时出错

Error reading response length from authentication socket

在我的 ruby rails 项目中,我使用 capistrano、unicorn、postgresql 和 nginx 来部署我的项目。当我 运行 cap production git:check 我收到这个错误:

Error reading response length from authentication socket.

日志跟踪:

INFO [13522bc0] Running /usr/bin/env mkdir -p /tmp/deploy_test/ as mezbah@192.168.137.130
DEBUG [13522bc0] Command: /usr/bin/env mkdir -p /tmp/deploy_test/
INFO [13522bc0] Finished in 0.291 seconds with exit status 0 (successful).
DEBUG Uploading /tmp/deploy_test/git-ssh.sh 0.0%
INFO Uploading /tmp/deploy_test/git-ssh.sh 100.0%
INFO [3b379ef0] Running /usr/bin/env chmod +x /tmp/deploy_test/git-ssh.sh as mezbah@192.168.137.130
DEBUG [3b379ef0] Command: /usr/bin/env chmod +x /tmp/deploy_test/git-ssh.sh
INFO [3b379ef0] Finished in 0.067 seconds with exit status 0 (successful).
INFO [8355617a] Running /usr/bin/env git ls-remote --heads git@github.com:mezbahalam/deploy_test.git as mezbah@192.168.137.130
DEBUG [8355617a] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/deploy_test/git-ssh.sh /usr/bin/env git ls-remote --heads git@github.com:mezbahalam/deploy_test.git )
DEBUG [8355617a]    Error reading response length from authentication socket.
DEBUG [8355617a]    6399a4a331342141ed3bbf3afb58f58828f96c76    refs/heads/master
INFO [8355617a] Finished in 9.683 seconds with exit status 0 (successful).

我读了一些 posts 但我想不出任何解决办法。

我不确定为什么会发生这种情况,但我已经在我的许多部署中看到它并且它们继续完美地工作。我觉得这个错误可以忽略。

TL;DR

# start/restart ssh-agent
eval "$(ssh-agent -s)"

# add the desired ssh-key
ssh-add ~/.ssh/id_rsa

有关详细信息,请参阅:https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/


我过去也遇到过同样的问题,这个 post 帮我解决了很多问题: http://www.antleon.com/2014/04/rails-capistrano-deployment-ssh-error-reading-response-length-from-authentication-socket/

希望对您有所帮助。

当我遇到这种情况时,是因为 ssh-agent 不再是 运行。我重新启动它并检查了 运行 ssh-add -L

时是否列出了一个密钥