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.

1 Answers1

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 git@github.com 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 git@github.com:anAccount/aRepo, ...

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250