Re: [git-users] "cannot spawn ssh" while trying to push changes to remote (e.g. github)

2,060 views
Skip to first unread message

Konstantin Khomoutov

unread,
Jun 13, 2012, 8:02:11 AM6/13/12
to git-...@googlegroups.com, Patryk Małek, msysGit Mailinglist
On Wed, 13 Jun 2012 03:49:23 -0700 (PDT)
Patryk Małek <malek...@gmail.com> wrote:

> I have a problem with github - namely I cannot push changes to remote
> server i.e. github because I always get "cannot spawn ssh/plink "etc
> etc errors . I am using Win7 (git installation with separate bash )
> and I have been already trying many things with e.g. environment
> variables ( GIT_SSH ) . I have even created a topic on
> www.stackoverflow.com but noone was able to help me.
> http://stackoverflow.com/questions/10574267/cannot-spawn-ssh-when-connecting-to-github-but-ssh-t-gitgithub-com-works
>
>
> I have used ssh installed with git or e.g. plink from putty's package
> but none of these worked . I have tried setting GIT_SSH to
> executables and then to directories with executables but none of
> these worked either. I know that there is an issue with directories
> with spaces so I placed exes to C:\Putty\ but still no go.
>
>
> Please help me because I really want to try Git but I cannot even
> start since I have this problem.

Cc-ing to the msysgit mailing list as this question most probably
belongs there.

Please provide exact description of your setup, what commands you run
and what output they provide (copy and paste exactly). Better run the
commands with GIT_TRACE environment variable set to "1" beforehand
to produce verbose output.

Note that your post is too inconstructive as it sounds like "I've tried
a number of different combinations of different settings, none worked".
Working with remote repos works for many people both with packaged
OpenSSH client and with plink.exe from PuTTY, so try sticking to one
solution and let's start from there.
For instance, try sticking with PuTTY, verify the GIT_SSH environment
variable is correctly set (to the full path to plink.exe, possibly
double-quoted if PuTTY is installed under %ProgramFiles%),
then verify plink.exe works for you outside or Git by running something
like
plink.exe y...@git.server "git --version"
Then re-try with Git, post what you run and what output you get.
Provide detailed info about your OS.

Thomas Ferris Nicolaisen

unread,
Jun 13, 2012, 9:22:38 AM6/13/12
to git-...@googlegroups.com, Konstantin Khomoutov, msysGit Mailinglist
Reading your post on StackOverflow, it looks to me like you are mixing Cygwin/Git Bash with normal Windows paths.

I would suggest the following: 
  1. Start from scratch, remove all keys and software you set up/installed already.
  2. Try Github for Windows. If that works, at least you know it's physically possible to clone something from Github.
  3. Now decide, as Konstantin says, whether you want to use openssh for authenticating (easier, and recommended by Github), or Putty (more Windows GUI oriented)
    • If you go for the openssh way, follow Github's how-to.
    • If you go for the Putty approach, follow my guide here
    • Whichever approach you pick, follow the instructions to the letter, and tell us where it goes wrong, if at all. 

Patryk Małek

unread,
Jun 13, 2012, 8:30:27 AM6/13/12
to Konstantin Khomoutov, git-...@googlegroups.com, msysGit Mailinglist
Ok so I have tried to do this  plink X...@github.com "git --version"  but I have received this error : 

C:\Users\XXX>plink X...@github.com "git --version"
FATAL ERROR: Disconnected: No supported authentication methods available (server sent: publickey)


When I set my GIT_SSH to C:\Putty\  (where I have plink.exe) (I have also added  C:\Putty\   to PATH )  then I get this on git clone   

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


What other information should I provide ? 



2012/6/13 Konstantin Khomoutov <flat...@users.sourceforge.net>

Konstantin Khomoutov

unread,
Jun 13, 2012, 10:17:45 AM6/13/12
to Patryk Małek, Konstantin Khomoutov, git-...@googlegroups.com, msysGit Mailinglist
On Wed, 13 Jun 2012 14:30:27 +0200
Patryk Małek <malek...@gmail.com> wrote:

> Ok so I have tried to do this *plink X...@github.com "git --version"
> * but I have received this error :
>
> *C:\Users\XXX>plink X...@github.com "git --version"
> FATAL ERROR: Disconnected: No supported authentication methods
> available (server sent: publickey)*

This means github only supports public-key-based authentication
(the SSH protocol specifies at least three other, including a
widely-known password-based). Since you did not add your github key to
your SSH key agent (pageant.exe from PuTTY), plink saw no usable
key and hence failed to authenticate you.

I somehow feel this will be the next obstacle you will run into
so after you fix GIT_SSH (we'll get to that in a moment), be sure
to read [1] which deals with generating and using SSH keys via PuTTY and
[2] which deals with associating those keys with your github account.

> When I set my *GIT_SSH* to *C:\Putty\ * (where I have plink.exe) (I
> have also added *C:\Putty\* to *PATH ) *then I get this on *git
> clone * *
> *
> *$ GIT_TRACE=1 git clone g...@github.com:XXX/AffableBean
> trace: built-in: git 'clone' 'g...@github.com:XXX/AffableBean'
> Cloning into 'AffableBean'...
> trace: run_command: 'C:\Putty\' 'g...@github.com' 'git-upload-pack
> '\''XXX /AffableBean'\'''
> error: cannot spawn C:\Putty\: No such file or directory
> fatal: unable to fork*

Well, Git precisely tells you what happened: it failed to execute
"C:\Putty\". Does attempt to execute a directory appear to be OK to
you? It shouldn't. As I've told you in my previous response, the
GIT_SSH environment variable has to be set to the full pathname of the
plink.exe binary which is (probably) "C:\Putty\plink.exe" in your
particular case.

> What other information should I provide ?
That's already enough.

1. http://nathanj.github.com/gitguide/tour.html#pushing
2. https://help.github.com/articles/generating-ssh-keys

Patryk Małek

unread,
Jul 10, 2012, 5:23:46 PM7/10/12
to Konstantin Khomoutov, git-...@googlegroups.com, msysGit Mailinglist
Hello again, 

A lot of time passed since my last e-mail but I have been trying some different approaches to this problem but ... none worked. I have tried as you suggested to go with Github for Windows which actually worked - but it's not a go for me since I need this now for my work project where we have a Git repo on our own server. 

All the rest of the options have failed for me. I Have tried setting the GIT_SSH  to both C:\Putty\plink.exe  or leaving it as it was after the install with openssh's path(+exe name) but none worked - I still get "cannot spawn" error. 


I have reinstalled Git at least 50 times already trying different options, clearing it's environmental variables and directories at the same time. 

Why is this not working for me ?!


2012/6/13 Konstantin Khomoutov <flat...@users.sourceforge.net>



--

pozdrawiam
Patryk Małek



Thomas Ferris Nicolaisen

unread,
Jul 11, 2012, 2:27:34 AM7/11/12
to msy...@googlegroups.com, Konstantin Khomoutov, git-...@googlegroups.com
On Tuesday, July 10, 2012 11:23:46 PM UTC+2, Patryk Małek wrote:
Hello again, 

A lot of time passed since my last e-mail but I have been trying some different approaches to this problem but ... none worked. I have tried as you suggested to go with Github for Windows which actually worked - but it's not a go for me since I need this now for my work project where we have a Git repo on our own server. 

All the rest of the options have failed for me. I Have tried setting the GIT_SSH  to both C:\Putty\plink.exe  or leaving it as it was after the install with openssh's path(+exe name) but none worked - I still get "cannot spawn" error. 


I have reinstalled Git at least 50 times already trying different options, clearing it's environmental variables and directories at the same time. 

Why is this not working for me ?!


Github for Windows bundles msysgit and openssh, so if it works there it means there's still a configuration error on your side.

Note that you can point Github for Windows towards other non-Github repositories. You can also use the command line Git that bundles with Github for Windows. If this works for you, I don't see what the problem is.

Anyhow, if you want concrete suggestions, you have to give us some concrete description of your environment, the steps you made and the error messages you got. Saying "I tried 50 times" is not helping.

Patryk Małek

unread,
Jul 13, 2012, 7:48:06 AM7/13/12
to git-...@googlegroups.com, msy...@googlegroups.com, Konstantin Khomoutov
So to reproduce what I have done besides reinstalling a bunch of times: 
- I have uninstalled Git and all its GUI frontends from the system that I have installed (git extensions, github for windows etc ect)
- I have deleted  GIT_SSH  environmental variable 
- uninstalled whole putty package
- cleared git config files and keys etc
- used ccleaner to clean registry and disk from unnecessary files , registry keys
- restarted Windows 7 (64 bit)

THEN, I have downloaded newest version of git from website https://github.com/downloads/msysgit/git/Git-1.7.11-preview20120620.exe 
using settings to integrate git with command line.

and while trying to do anything involving access through SSH i have obtained once again 'Cannot spawn ssh' error message.

I have no idea whatsoever what can be done more in this matter. I have even used processmonitor application to take a look what/how git is trying to launch ssh client but I have not found it there


2012/7/11 Thomas Ferris Nicolaisen <tfn...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "Git for human beings" group.
To view this discussion on the web visit https://groups.google.com/d/msg/git-users/-/ANk9rHnI-gYJ.

To post to this group, send email to git-...@googlegroups.com.
To unsubscribe from this group, send email to git-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/git-users?hl=en.



--

pozdrawiam
Patryk Małek



Thomas Ferris Nicolaisen

unread,
Jul 13, 2012, 9:59:32 AM7/13/12
to msy...@googlegroups.com, git-...@googlegroups.com, Konstantin Khomoutov


On Friday, July 13, 2012 1:48:06 PM UTC+2, Patryk Małek wrote:
So to reproduce what I have done besides reinstalling a bunch of times: 
- I have uninstalled Git and all its GUI frontends from the system that I have installed (git extensions, github for windows etc ect)
- I have deleted  GIT_SSH  environmental variable 
- uninstalled whole putty package
- cleared git config files and keys etc
- used ccleaner to clean registry and disk from unnecessary files , registry keys
- restarted Windows 7 (64 bit)

THEN, I have downloaded newest version of git from website https://github.com/downloads/msysgit/git/Git-1.7.11-preview20120620.exe 
using settings to integrate git with command line.

and while trying to do anything involving access through SSH i have obtained once again 'Cannot spawn ssh' error message.

I have no idea whatsoever what can be done more in this matter. I have even used processmonitor application to take a look what/how git is trying to launch ssh client but I have not found it there

OK, so you have a clean slate and you want to do the OpenSSH approach in a normal Windows command line (cmd.exe). 

During the Git installer, I assume you chose "Run Git and included Unix tools from the Windows Command Prompt". This is the third and last option with the scary red warning below. Did you choose this option? If you did not choose this option, you have to use Git Bash instead of normal command-line below.

To make things a bit less complex, let's make sure SSH works. Try the following:
  • Start Command line (Start -> Run -> 'cmd')
  • ssh -T username@your-git-server
What does the command above output?

Johannes Sixt

unread,
Jul 13, 2012, 1:58:58 PM7/13/12
to Patryk Małek, git-...@googlegroups.com, msy...@googlegroups.com, Konstantin Khomoutov
Am 13.07.2012 13:48, schrieb Patryk Małek:
> THEN, I have downloaded newest version of git from
> website https://github.com/downloads/msysgit/git/Git-1.7.11-preview20120620.exe
> using settings to integrate git with command line.
>
> and while trying to do anything involving access through SSH i have
> obtained once again 'Cannot spawn ssh' error message.

Would you mind writing down what *EXACTLY* the command was and what it
reported instead of telling stories? Then you might even get some help.

For example, nowhere in git's code can I find the string "Cannot spawn"
-- so either you are making up an error message, or the message is from
some other tool. I do see "cannot spawn" somewhere, but it is not the
same error message that you cite.

-- Hannes

Patryk Małek

unread,
Jul 18, 2012, 2:56:45 AM7/18/12
to git-...@googlegroups.com, msy...@googlegroups.com, Konstantin Khomoutov
Hello, 

Soooo, after trying and trying I have finally came to a solution :)

My firewall from Comodo Internet Security suite was blocking ssh clients somehow. Although I have no idea why and how because I can successfully connect to other machine via SSH. 

Now I will have to find a new firewall to be fully able to use git features.  

Thank you guys for help :)
Reply all
Reply to author
Forward
0 new messages