[Solved] Heroku- permission denied (publickey)

While trying to clone a git repository from the heroku I got the problem as shown in the screenshot below::
which mentions

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

[Solved] Heroku- permission denied (publickey)
After few googling, Then I found that I had to re-upload my public keys to heroku using the command listed below. I had to re-upload because I recently made few changes to my username/password.

$ heroku keys:add ~/.ssh/id_rsa.pub

id_rsa.pub is the public key generated using the command.

$ ssh-keygen -t rsa -C "your_email@domain.com"

After adding the keys to heroku. I was able to clone the heroku repositories as before. I hope this helps someone.

Samundra Shrestha

Fullstack Developer, Senior Software Engineer

14 thoughts on “[Solved] Heroku- permission denied (publickey)

  • May 3, 2014 at 4:10 PM
    Permalink

    This didn’t actually work for me on my new computer, so I tinkered with it a bit, and it was actually a really simple fix:

    I just ran
    $ ssh-keygen
    named it nothing, with no password (hit enter 3 times is all)
    then I ran
    $ heroku keys:add ~/.ssh /id_rsa.pub

    Reply
    • May 4, 2014 at 9:43 AM
      Permalink

      Zbee, The first time you ran

      heroku keys_add 

      didn’t work because your system had not any keys to add. So with

      ssh-keygen

      you generated SSH keys with default settings. After that you added those keys to heroku. Perhaps I should have been more descriptive here. I am happy that you figured it out :).

      Reply
  • April 18, 2014 at 4:15 PM
    Permalink

    This fixed my problem too, thanks!

    Reply
  • February 6, 2014 at 7:16 AM
    Permalink

    This solved my problem, thank you!

    Reply
  • July 31, 2013 at 2:21 PM
    Permalink

    Thanks! It really solved for me!

    Reply
  • March 17, 2013 at 3:19 PM
    Permalink

    Thx!!! This works. I have also ssh for github and i woried about him, but this only add new and work perfectly:) thanks a lot.

    Reply
  • December 12, 2012 at 7:07 PM
    Permalink

    I tried a few different things from stack overflow and none worked. This did the trick. Thanks!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *