Github, Puttygen, & Pageant: Permission Denied (publickey)

3

1

I'm using msysgit on Windows 7 as well as the PuTTY suite.

I opened Puttygen and clicked the "Generate" button. I moved my cursor around to "generate some randomness". After the key was created, I entered a passphrase for the key and clicked "Save private key". I saved the file as "private.ppk" in the directory c:/Users/Kristen/.ssh.

Then I clicked "save public key" and saved the file as "public.pub" inside c:/Users/Kristen/.ssh.

Then I copied the contents of the field labeled "Public key for pasting into OpenSSH authorized_keys file". I did not copy the contents of the public.pub file, because I know that has extra data that will break the key.

I went to my GitHub account, went to Settings > SSH Keys, and clicked the "Add SSH key" button. I gave they key a title, then pasted in the key I copied from Puttygen and clicked "Add Key". The key was saved successfully.

I opened Pageant and clicked "Add Key". I selected the file "public.ppk" from c:/Users/Kristen/.ssh. I entered the passphrase.

I opened Git bash and typed ssh git@github.com. It asked me if I wanted to add github.com to the list of known hosts. I typed yes. Then I got this error:

Permission denied (publickey).

Then I typed ssh -v git@github.com and got this output:

enter image description here

I saw that it was looking for id_rsa, so I created a directory named id_rsa and placed my keys inside it.

Then I typed ssh git@github.com again, and got this message:

Enter passphrase for key c:/Users/Kristen/.ssh/id_rsa:

I entered the passphrase for my private key but it kept asking again and again.

Then I deleted that folder and changed the name of my private key to id_rsa.ppk, but got the same "Permission denied (publickey)" message.

I went into Control Panel > System > System Properties > Advanced > Environment Variables, and my GIT_SSH variable is set to c:\Program Files (x86)\PuTTY\plink.exe, and I confirmed that Plink does live in that folder.

Not sure what else to try. Suggestions?

kmgdev

Posted 2013-03-05T01:09:25.857

Reputation: 193

Answers

1

I saw that it was looking for the private key in a folder called id_rsa.

No, I can assure you, id_rsa would be the name of a private ssh key file, not a directory.

Your keys should be in %HOME%/.ssh, but if you are using plink and pageant (and not openssh), make sure the environment variable GIT_SSH reference plink.exe.
See for instance "How do I set GIT to use Plink.exe".

env var

See this tutorial to generate your keys.

VonC

Posted 2013-03-05T01:09:25.857

Reputation: 13 292

Ah, I assumed since id_rsa didn't have an extension it was a directory. Anyway, I've confirmed that the path to Plink in my GIT_SSH variable is correct, and I've updated my question to include that. – kmgdev – 2013-03-05T16:05:51.113

@kgrote try and regenerate your keys following http://nathanj.github.com/gitguide/tour.html#pushing (and publish the new public key)

– VonC – 2013-03-05T16:13:27.750

Hmm, it works fine when I git push, but not when I use the ssh command. Obviously that doesn't really matter, but it's damned annoying. – kmgdev – 2013-03-05T23:08:27.163