“Cannot spawn ssh” when connecting to Github, but ssh -T [email protected] works?

None of the answers so far worked for me. What ended up fixing this issue for me was removing quotes from my GIT_SSH variable and don’t escape any characters at all, no MSYS path style (eg. /c/path\ to\ putty/plink.exe). Just enter the path normally, Git handles the quoting.

set GIT_SSH=C:\path to putty\plink.exe

That’s it. When using GIT_TRACE you can see that the variable gets quoted in the resulting command so:

  1. the added double quotes change the string passed to the command and

  2. the path is wrapped in single quotes so the spaces are ok.

Hope that helps someone.

Leave a Comment