permission denied (publickey) Error using git on windows 7

When I want to push to github with this command

git push origin master

I got this

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

So, what's wrong?


Solution 1:

EUREKA!

Apparently, you can use plink as the main ssh client and just load your keys in pageant (if you're like me, you already do):

You can do that by setting the GIT_SSH env variable to plink.exe path like so:

set GIT_SSH=C:\Program Files\PuTTY\plink.exe

or, you can use plink from TortoiseGit:

set GIT_SSH=c:\Program Files\TortoiseGit\bin\TortoisePLink.exe

Credit: Original solution taken from this blog post

Solution 2:

I was able to resolve this issue as follows:

When you do:

ssh-keygen -t rsa

it prompts you to (optionally) enter a filename for saving the generated keys. Specifying a filename wasted my whole day! Next day I let it use the default filename and the problem(s) disappeared! Imagine!!

Platform was Win7 and msysgit.