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

和自甴很熟 提交于 2019-12-04 03:47:04
mozz100

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)

Charlie Banalie

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!

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