Cannot get git extensions to push something to github SSH problems

user1115652 picture user1115652 · Nov 6, 2010 · Viewed 13.6k times · Source

Im trying to use git extensions and I really like it so far, but I don't manage to push to github. The following command works fine in git bash:

git push "origin" master:master

and then when I push with git extensions I get this:

C:\Program Files\Git\bin\git.exe push "origin" master:master
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Done

In the git settings it just has openSSH selected which I would like to keep because putty seems more hassle.

The remote addres I have added in gitextensions, actually the only thing I have done from the bash just to test is the command above and gerenating the SSH keys. All else is set up in git extensions. So I suppose everything must be set up correctly. Eg, the email adress and name are correct...

ssh [email protected]

also connects fine, from bash

edit:

So I can reproduce the error by putting the command from git-extensions in cmd. Appearantly there is a difference between running from git bash and from cmd and git-extensions runs this command like a windows command... any clues?

update: If I choose git-bash from the menu in git-extensions I get a window that is exactly the same as when I right click in explorer on my repo folder and choose git bash here. Now, in the one opened from explorer I can push and in the one opened from extensions I get the public key problem.

Answer

max picture max · Nov 6, 2010

Things to check for:

  1. Presence of HOME environment variable.
  2. Presence of %HOME%\.ssh\ and RSA keys there.

When you run git from command promt it is preferred to run git.cmd, because it fixes HOME automatically:

@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%

To fix gitextensions, define HOME variable and set it to same value as USERPROFILE