4

I am new to heroku and I can't push my rails project.

I can successfully login to heroku, and I have keys

 Keys
 ssh-rsa AAAAB3NzaC...oPiDGoh0Gt root@Slava-System-Product-Name

but when I git push heroku master I receive

 Permission denied (publickey).
 fatal: The remote end hung up unexpectedly
Luís Ramalho
  • 10,018
  • 4
  • 52
  • 67

1 Answers1

11

A common key error is: Permission denied (publickey). You can fix this by using keys:add to notify Heroku of your new key.

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

https://devcenter.heroku.com/articles/keys

UPDATE, solution from the following blog post worked.

  1. Create a new public key

    ssh-keygen -t rsa

  2. Upload to heroku

    heroku keys:add /root/.ssh/id_rsa.pub

Luís Ramalho
  • 10,018
  • 4
  • 52
  • 67
  • 1
    I made this and upload SSH public key. But have the same error when try "git push heroku master" Permission denied (publickey). fatal: The remote end hung up unexpectedly –  May 05 '13 at 12:49
  • What is the name of your public key? I have updated my answer. – Luís Ramalho May 05 '13 at 12:51
  • I try "heroku keys:add ~/.ssh/id_rsa.pub" any changes, same error. === s**************@gmail.com Keys ssh-rsa AAAAB3NzaC...oPiDGoh0Gt root@Slava-System-Product-Name –  May 05 '13 at 12:54
  • in my root/.ssh/ i have files: id_rsa, id_rsa.pub, known_hosts. Im not shure, but I use github keys from the same folder? Github works normal way. –  May 05 '13 at 12:57
  • Have you logged in? `heroku login` – Luís Ramalho May 05 '13 at 12:59
  • Yes, Authentication successful. –  May 05 '13 at 13:03
  • Have you got more than 1 heroku account? – Luís Ramalho May 05 '13 at 13:04
  • No, I have only 1 heroku acc, but i tried to create and delete keys many times. –  May 05 '13 at 13:06
  • I'd suggest you to clean all the previous keys, and start all over again. Not sure what might be causing your problem. – Luís Ramalho May 05 '13 at 13:10
  • How heroku files from root/.ssh/ are related with Git keys? If i delete all of them could i have problems with git push? –  May 05 '13 at 13:14
  • You can then just add the keys to GitHub, https://help.github.com/articles/generating-ssh-keys – Luís Ramalho May 05 '13 at 13:15
  • Thanks for your answers. I delete all keys from .ssh folder. Generate and add new keys but still have same error - Permission denied (publickey). fatal: The remote end hung up unexpectedly –  May 05 '13 at 13:24
  • 1
    found solution here - http://www.whatibroke.com/?p=284 –  May 05 '13 at 13:40
  • Glad you found the solution, I have updated my answer in case someone runs into the same issue. Thanks! – Luís Ramalho May 05 '13 at 13:44
  • Updated solution worked for me on Mac 10.8.4. Thanks! – sahaj Nov 22 '13 at 08:40