4

I am trying to add my ssh to git. I have generated it, there are 2 files in ~/.ssh In a terminal (MINGW64) I type:

$ eval "$(ssh-agent -s)" 

It responds:

Agent pid 3480 

Then I type

$ ssh-add ~/.ssh/id_rsa 

It responds (after like 15 secs):

Error connecting to agent: Connection timed out 

The whole code (with no ssh-agent.exe processes run):

MNXALbl4@DESKTOP-GTSHV44 MINGW64 /c/NodeWebServer (master) $ ls -al ~/.ssh total 36 drwxr-xr-x 1 MNXALbl4 197609 0 июл 5 02:05 ./ drwxr-xr-x 1 MNXALbl4 197609 0 июл 5 02:08 ../ -rw-r--r-- 1 MNXALbl4 197609 3243 июл 5 02:05 id_rsa -rw-r--r-- 1 MNXALbl4 197609 741 июл 5 02:05 id_rsa.pub MNXALbl4@DESKTOP-GTSHV44 MINGW64 /c/NodeWebServer (master) $ eval "$(ssh-agent -s)" Agent pid 12824 MNXALbl4@DESKTOP-GTSHV44 MINGW64 /c/NodeWebServer (master) $ ssh-add ~/.ssh/id_rsa Error connecting to agent: Connection timed out 

Any ideas? I tried all solutions I could find.

12
  • Does your private key have a passphrase? Commented Jul 5, 2018 at 4:33
  • no, it was generated through the standard " ssh-keygen -t rsa -b 4096 -C "[email protected]" " command, and then had nothing done with it. Commented Jul 5, 2018 at 12:32
  • Then you don't need ssh-agent. At all. Commented Jul 5, 2018 at 12:33
  • Thank you, thou the course I am currently taking (following all of the steps), explicitly showed all of the above steps (including the agent launch, with the same key creation path) working for the instructor, without any errors on his side (it was on mac OS thou) Commented Jul 5, 2018 at 12:36
  • OK, I suppose adding a passphrase-less key to an agent should work (even if it is not useful). What git version are you using on your Windows? Commented Jul 5, 2018 at 12:37

1 Answer 1

1

If eval $(ssh-agent -s) (without quotes) does not yield better result (as seen here), don't forget that the SSH agent is needed only for private SSH keys protected with a passphrase.

For testing, try the same command in a git bash launched after setting a simplified PATH for Git:

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\ set GH=C:\path\to\git set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH% set PATH=%PATH%;/path/to/ThreadScope/bin 

This is not the case here, and ssh -T [email protected] returns the expected "Welcome" message, which validates your authentication.

So you can ignore that ssh-agent step, and simply proceed with the rest of your work: git clone [email protected]:anAccount/aRepo, ...

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.