“Cannot spawn ssh” when connecting to Github, but ssh -T email@example.com works?
I am having a hard time getting Github (+Netbeans to work).
- GIT Source Control
- Import a remote repository as subdirectory with full history
- Can I move a local Git repository to elsewhere within my hard drive safely?
- git diff to see what a merge would introduce
- Differentiated access rights in distributed VCS's
- Project Structure for Product with Different Versions
$ git clone firstname.lastname@example.org:USER/PROJECTNAME.git error: cannot spawn C:\Program Files (x86)\Git\bin\ssh.exe: No such file or directory fatal: unable to fork
Note: For now, my
GIT_SSH environment variable is pointing to
C:\Program Files (x86)\Git\bin\ssh.exe, but I have also tried
C:\Program Files (x86)\Git\bin, erasing it entirely, pointing to putty’s/plink’s folder, and pointing to their executables, but still the same message.
When I test the connection everything works fine:
$ ssh -T email@example.com Hi USER! You've successfully authenticated, but GitHub does not provide shell access.
What am I doing wrong? Does it make a difference if I do the
git init in the directory in the first place?
This didn’t help:
plink.exe and adding plink’s path to
**EDIT 2 **
result of command with
$ GIT_TRACE=2 git clone firstname.lastname@example.org:XXX/AffableBean trace: built-in: git 'clone' 'email@example.com:XXX/AffableBean' Cloning into 'AffableBean'... trace: run_command: 'Plink.exe' '-batch' 'firstname.lastname@example.org' 'git-upload-pack '\''XXX/AffableBean'\''' error: cannot spawn Plink.exe: No such file or directory fatal: unable to fork
8 Solutions collect form web for ““Cannot spawn ssh” when connecting to Github, but ssh -T email@example.com works?”
Have you tried installing ssh.exe to a path that does not contain spaces? And have you tested whether quoting backslashes works (
You could also try
GIT_TRACE=2 git clone <...>, it should show you the command and parameters git is trying to run for connecting.
In my case setting GIT_SSH to:
GIT_SSH=/c/Program\ Files\ (x86)/Git/bin/ssh.exe
worked in git bash.
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:
the added double quotes change the string passed to the command and
the path is wrapped in single quotes so the spaces are ok.
Hope that helps someone.
This is really embarrassing but the real problem was with my firewall
Comodo Firewall which somehow was blocking the ssh connection from being initialized by
I can without any problems connect via ssh e.g. using command line or Putty but somehow
Comodo was causing this weird issue.
Thanks everyone for support!
i think a path (ex: C:\Program Files (x86)\Git) having blank space so it cannot recognise.
to resolve it
make a simple link to shorten path
mklink /d “C:/Git” “C:\Program Files (x86)\Git”
it works for me and also for Jenkins (if you use it with Git plugin)
- set GIT_SSH=C:\Git
- Finally, set PATH to
Unless you have some obscure anti-virus interaction, the only other case (beside issue 313 you are referring to) where this error message is seen is:
“error: cannot spawn git: No such file or directory”
if you ever get this error “
error: cannot spawn git: No such file or directory” its a really nasty issue.
It took me a day to track it down, but it boils down to if you have more then 500 tags in a repository it must blow up some internal command line limits.
TLDR: if you get this error, remove a bunch of your tags.
On my windows 7 default ms git bash installation I needed to set GIT_SSH to:
"C:\\Program Files (x86)\\Git\\bin\\ssh.exe"
So just find your ssh.exe provided with Git installation and update the above with correct dir.
To make this persistent every time you run git bash just add your home dir in .bashrc file this:
export GIT_SSH="C:\\Program Files (x86)\\Git\\bin\\ssh.exe"
I was constantly getting the error
error: cannot spawn “C:\Plink.exe”: No such file or directory
fatal: unable to fork
git push and
git pull. I solved it by going into the .git/config file and changing
url = firstname.lastname@example.org:<USER>/<REPO>.git
url = https://github.com/<USER>/<REPO>
Hope this helps!