“Cannot spawn ssh” when connecting to Github, but

2019-02-03 02:08发布

I am having a hard time getting Github (+Netbeans to work).

I want to use ssh with git (on Windows 7) to, e.g., commit or clone a project, but I keep getting this error message :

$ git clone git@github.com: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 git@github.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?

EDIT:

This didn't help:

setting GIT_SSH to plink.exe and adding plink's path to PATH

**EDIT 2 **

result of command with GIT_TRACE=2

$ GIT_TRACE=2 git clone git@github.com:XXX/AffableBean
trace: built-in: git 'clone' 'git@github.com:XXX/AffableBean'
Cloning into 'AffableBean'...
trace: run_command: 'Plink.exe' '-batch' 'git@github.com' 'git-upload-pack '\''XXX/AffableBean'\'''
error: cannot spawn Plink.exe: No such file or directory
fatal: unable to fork

8条回答
再贱就再见
2楼-- · 2019-02-03 03:00

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.

查看更多
Ridiculous、
3楼-- · 2019-02-03 03:03

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 git.

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!

查看更多
登录 后发表回答