Monday, August 6, 2012

error: cannot spawn "C:\Program Files\TortoiseGit\bin\TortoisePlink.exe": No such file or directory fatal: unable to fork

I've gotten this error several times when trying to use git over ssh:

E:\web2py\applications\k32>git clone ssh://k32@k32.com/gits/k32.git
Cloning into 'k32'...
error: cannot spawn "C:\Program Files\TortoiseGit\bin\TortoisePlink.exe": No such file or directory
fatal: unable to fork

Surprisingly, google couldn't help me. But, it turned out to be a very simple fix.

The problem was the space in the GIT_SSH environment variable pointing to TortoisePlink.exe. I copied the "C:\Program Files\TortoiseGit\bin\" directory to "C:\TortoiseGit\bin\" and set GIT_SSH to "C:\TortoiseGit\bin\". I actually created a symbolic link, instead of actually copying it. I didn't want to risk breaking TortoiseGit, so I didn't actually move the directory. Of course, the right answer would be uninstall TortoiseGit and reinstall it in the above folder without a space in the path, but I really wasn't in the mood for yet another can of worms today.

Update Oct 15 2015:
This happened to me again on a new machine.

error: cannot spawn C:\Program Files (x86)\PuTTY\plink.exe;

Git_SSH was already set to the right path. Changing it to use %ProgramFiles(x86)% instead of the full spelled out path didn't help. After making a symbolic link to Putty on the root folder and pointing Git_SSH there, it started working.

7 comments:

  1. Your article on the issue helped me to fix the issue in few minutes, Thanks a lot Naveed.

    ReplyDelete
  2. You're most welcome Pushpa! Thanks for taking the time to let me know that it helped you.

    ReplyDelete
  3. Just set it to a variable like so: Set GIT_SSH = %ProgramFiles(x86)%\PuTTY\plink.exe

    ReplyDelete
  4. The problem was probably a bug in the version of git at the time the article was written. I haven't encountered it on new machines recently.

    ReplyDelete
  5. I also met the problem, fllow the step ,right click -> TortoiseGit -> Settings -> Net Work -> SSHclient ,refrsh the right path you installed,I hope it will help you

    ReplyDelete
  6. Thanks for this!!! Helped a lot.

    ReplyDelete