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

时光总嘲笑我的痴心妄想 提交于 2019-12-21 09:22:03

问题


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.


回答1:


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)




回答2:


this is how i solved my problem:

i've installed heroku toobelt and used heroku keys:remove to remove my old key for this PC, then:

1.
add C:\Program Files (x86)\Git\bin to the %PATH% as in this answer https://stackoverflow.com/a/6318188/521088
(so heroku key:add can use ssh-keygen)

2.heroku keys:add

Done!



来源:https://stackoverflow.com/questions/15000662/git-heroku-permission-denied-public-key-after-adding-public-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!