1

I know that the use of Git and SSH has been asked many times and answered, however, here is my problem.

I have the dreaded 'Could not open a connection to your authentication agent'. I understand how the ssh-agent works and it uses a socket file to communicate. If you do not specify the file ssh-agent uses /tmp/ssh-xxxxxxx/agent.pid as the default. With Windows 8.1 you can not create files in the main drive so Windows will put a redirect into C:\Users\userid\AppData\Local\Temp and put the file there. These are bieng created.

When I call eval $(ssh-agent) within Bash the agent is started as a separate process. I create the appropriate environment variables (SSH_AUTH_SOCK, SSH_AGENT_PID) in my Git Bash environment. When I call ssh-add it fails.

To test my understanding I have used a file within my User Directory by calling ssh-agent -a 'c:/Users/userid/Temp/socket' and set the environment variables correctly. Again it fails.

I then started the agent in debug mode ssh-agent -da 'c:/Users/userid/Temp/socket' which did not fork a process as expected. I then went to a Windows cmd prompt and set the environment variables. I then entered ssh-add, it worked, I was asked for the pass phrase for my private key.

My question is: Does anyone know why the background process is not picking up the ssh-add?

A few things have come to mind:

  1. The background process is using a different user id and thus can not have access to the socket file.

  2. The background process is not getting it environment variables set correctly.

I believe this is a Windows problem rather than an ssh one.

Any thoughts?

  • Are you using the ssh-agent coming with Git for Windows? Do you see the same issue with the latest Git for Windows? (the 2.4.2.1: https://github.com/git-for-windows/git/releases) – VonC Jun 03 '15 at 18:22
  • I am using Git-1.9.5-preview20150319 from https://git-scm.com/download/win. It looks like there is a newer version. Would you recommend I switch? –  Jun 04 '15 at 05:24
  • Just tried it with suggested version, same thing happens –  Jun 04 '15 at 05:48
  • Do you have a `$HOME/.bashrc` in your git-for-windows bash session? (as in https://confluence.atlassian.com/display/BITBUCKET/Troubleshoot+SSH+Issues#TroubleshootSSHIssues-Couldnotopenaconnectiontoyourauthenticationagent) – VonC Jun 04 '15 at 08:29
  • Did you try http://stackoverflow.com/a/14913230/6309? – VonC Jun 04 '15 at 08:30
  • The other alternative would be to substitute ssh-agent with pageant: https://github.com/hbons/SparkleShare/issues/697#issuecomment-5530167 – VonC Jun 04 '15 at 08:32
  • Make sure GIT_SSH isn't already set (and pointing to, for instance, pageant while you are trying to use ssh_agent) – VonC Jun 04 '15 at 09:38
  • Thanks VonC.Git for Windows is quite different than Git-1.9.5.preview20150319 and I could not find an sensible documentation. To answer your other questions: 1. I have been follwoing the instructions for [confluence.atlassian.com/display/BITBUCKET](http://confluence.atlassian.com/display/BITBUCKET) 2. I looked at [stackoverflow.com/a/14913230/6309](http://stackoverflow.com/a/14913230/6309), not sure it helps. 3. I will look at pagaent. –  Jun 04 '15 at 10:25

0 Answers0