I am new to Rails, and I was trying to deploy a very simple app to Heroku. This is the second app that I deploy, and the first one I was able to do it just fine. However I am having some issues with this one. Whenever I "git push heroku master", I get this error:
! Your key with fingerprint xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx is not authorized to >access my_heroku_app.
fatal: The remote end hung up unexpectedly
I have tried to manage my keys after logging in heroku. If I type in my console "heroku keys", then I get:
No keys for myemailaddress.
However, If I run the comand "heroku keys:add" I get
Found existing public key: /Users/michele/.ssh/id_rsa.pub Uploading ssh public key /Users/michele/.ssh/id_rsa.pub ! Fingerprint already exists. Please use one ssh key per Heroku account
Please help me! This is soo frustating, I have no idea what's wrong! Thank you
Here's a very clear explanation that is lacking from ther Heroku documentation or other answers to the question. At least all the info doesn't seem to appear in any one place. It also let's you understand the problem in a way that the accounts tool doesn't.
Heroku identifies you in 2 ways:
The first is in .git/config
This seems to let you perform basic operations using
heroku
The second way heroku identifies you is by any operation that uses ssh (git push). Heroku will identify you by your ssh key, as stated here: https://devcenter.heroku.com/articles/keys
So each heroku account that you work on will have to send a different key to heroku when using ssh. Follow any tutorial to create your ssh keys.
The key is getting SSH to use different keys for each Heroku account. How do you do configure this? You'll need to do 2 things:
1) You'll need to make a 'dummy' domain that your .ssh/config will intercept and reconfigure. This will tell ssh the 'actual' domain you want, and which special ssh key to use.
2) Change your .git/config to use that when using git push. Instead of heroku.com, use the dummy domain you set in your .ssh/config
That's it :) A bit complicated and a bit simple at the same time. It has taken me 3 years of banging my head against the wall and trial and error to discover this info. It should be clearly documented somewhere, but at least it's a start.
Just wan´t to add the solution for Windows users.
First download "Putty Key generator"
Create a key with it OBS you need to move your mouse ower the blank area to generate randomness.
Save your keys, just remeber to rename your key to [name].pub
Run
heroku keys:add
in terminal!In my case the problem was the ssh version I was using. I just set the GIT_SSH environment variable to another ("GIT_SSH=/usr/bin/ssh") and everything worked OK for me.
I also have two Heorku accounts and as a work-around I "invited" my main account (the one whose key is used automatically by Heroku) as a collaborator to my project.