Search code examples
gitruby-on-rails-4capistrano3

Error reading response length from authentication socket


In my ruby on rails project, I am using capistrano , unicorn, postgresql and nginx for deploying my project. when I run cap production git:check I am getting this error:

Error reading response length from authentication socket.

log trace:

INFO [13522bc0] Running /usr/bin/env mkdir -p /tmp/deploy_test/ as [email protected]
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 [email protected]
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 [email protected]:mezbahalam/deploy_test.git as [email protected]
DEBUG [8355617a] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/deploy_test/git-ssh.sh /usr/bin/env git ls-remote --heads [email protected]: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).

I read some posts but I can't figureout any solution.


Solution

  • TL;DR

    # start/restart ssh-agent
    eval "$(ssh-agent -s)"
    
    # add the desired ssh-key
    ssh-add ~/.ssh/id_rsa
    

    See: https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ for more details.


    I went through the same issue in the past and this post helped me a lot to fix it: http://www.antleon.com/2014/04/rails-capistrano-deployment-ssh-error-reading-response-length-from-authentication-socket/

    Hope it helps.