Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Heroku Permission Denied Public Key (after adding public key)

I'm on Windows 7 64-bit. I'm using the latest Heroku Toolbelt and the GitHub Windows App (downloaded two days ago). Two days ago everything was perfect. I installed PHP and Apache, and suddenly Heroku just gives me

Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists

I have done these two commands repeatedly.

heroku keys:clear
heroku keys:add

I've deleted my keys and remade them. I've generated some with other apps (puttygen). I've uploaded them via command line and the web interface. I even made the GitHub Windows app generate a new key, and I uploaded that one. I can't git push or git clone from heroku. I've even tried making a new git repo locally and adding heroku as the remote and then pushing from there. No luck whatsoever.

I've read dozens of stackoverflow posts and tried every single solution offered. None helped.

Edit: I don't know if it matters, but I'm making a Facebook app and working through heroku's help page. I've restarted from the top and worked down, but I can't get past the git clone command. I've also reinstalled the heroku toolbelt from scratch.

like image 257
Chris Avatar asked Feb 21 '13 11:02

Chris


1 Answers

I experienced something similar - the same error message, from a very similar set up (latest heroku toolbelt, have Github windows client installed)

I think it is an assumption that git makes about the name of your public key file. Github's Windows client creates github_rsa and github_rsa.pub in your $HOME/.ssh directory. If you see only these in your ~/.ssh directory, try creating a new one with the standard name (id_rsa.pub), using ssh-keygen rather than the Github client.

I was able to solve this problem by following these steps.

Create a new public key using ssh-keygen:

$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
...

At this point I now have id_rsa and id_rsa.pub as well as the github keys in my .ssh directory.

Then re-upload it:

$ heroku keys:add ~/.ssh/id_rsa.pub
Uploading ssh public key...

(from http://www.whatibroke.com/?p=284 via git push heroku master Permission denied (publickey). fatal: The remote end hung up unexpectedly)

like image 147
mozz100 Avatar answered Oct 19 '22 13:10

mozz100