Michael Durrant
Michael Durrant

Reputation: 96454

heroku - rails - Permission denied (publickey)

heroku create
Creating floating-planet-1824......................... done, stack is bamboo-mri-1.9.2
http://floating-planet-1824.heroku.com/ | [email protected]:floating-planet-1824.git

git push heroku master
Warning: Permanently added the RSA host key for IP address '50.19.85.156' to the list of known hosts.
Agent admitted failure to sign using the key.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

I generated ssh keys ok.

Rebooting didn't help.

Upvotes: 15

Views: 8460

Answers (5)

Luis Ortega Araneda
Luis Ortega Araneda

Reputation: 875

Assuming you already have a public and a private key to use in your ~/.ssh folder, there might be two different scenarios:

  • You didn't upload your public key to Heroku's remote server. Solution, execute: heroku keys:add ~/.ssh/your_public_key
  • Or you did, but you don't have your identities loaded into your SSH authentication agent. Solution, execute:

    ssh-add -K ~/.ssh/your_private_key # OSX

    ssh-add -k ~/.ssh/your_private_key # Ubuntu

and enter your passphrase, so you can use your private key.

Upvotes: 15

egbutter
egbutter

Reputation: 790

In case others are facing the same problem: using standalone toolbelt on fedora 16-17 with rmv 1.17.3 and system ruby 1.9.3p392, just clearing heroku keys and credentials was not sufficient, and I tested that the issue was not with my ssh keychain. If anyone has faced similar issues, and is more familiar with the heroku toolbelt, I posted a new issue here.

Upvotes: 0

Aizzat Suhardi
Aizzat Suhardi

Reputation: 767

this is how i solved mine

$ heroku keys:clear
Removing all SSH keys... done
$ heroku login

after clearing all previous ssh. heroku login's uploads back my ssh public key and i can happily git push heroku master back

Upvotes: 20

amitchhajer
amitchhajer

Reputation: 12830

The problem which i face was setting the ssh environment variable.

SSH_AUTH_SOCK=0

heroku keys

will show the keys, remove and then login, it will create one for you and add to your app. Or you can create your rsa key with your email and then use it using

heroku keys:add /path

Generate key using ssh-keygen -t rsa -C "[email protected]"

Upvotes: 5

Michael Durrant
Michael Durrant

Reputation: 96454

It turned out that

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

worked.

Upvotes: 29

Related Questions