Cannot push to Heroku because key fingerprint
I had the same problem, I followed this post and others of the same kind without success :-((
Finally, I found the solution:I had to add my new rsa identity in my machine!
So, first of all I created a new rsa key:
ssh-keygen -t rsa -C "giordano.scalzo[at]gmail.com" -f ~/.ssh/id_rsa_heroku
then added it to my machine
ssh-add ~/.ssh/id_rsa_heroku
and, finally, to Heroku
heroku keys:add ~/.ssh/id_rsa_heroku.pub
After that,
git push heroku master
worked like a charm!
Hope this helps.
I, too have multiple keys and multiple heroku accounts, so I come across this problem every few months. As mentioned Giordano Scalzo, Tom Carchrae, and user664833, the main problem is ssh-agent, which you control using the ssh-add
command. The man page (man ssh-add
) is actually pretty clear and concise, so check it out.
You can list all the keys that ssh-agent knows about with:
ssh-add -l
You can delete all the keys that ssh-agent knows about with:
ssh-add -D
Or delete a specific key with
ssh-add -d ~/.ssh/id_rsa_example_key_file_use_your_own
Don't worry! You aren't actually deleting the keys, only changing which ones ssh-agent automatically tries to use, for example, when you try to push to heroku. It's easy to add and delete keys as needed, so for me, when I get frustrated by this problem, the easiest way to fix it is to delete all the keys and add back in only the one I want to use at the moment.
ssh-add -Dssh-add ~/.ssh/id_rsa_example_use_this_one_i_mean_it
Your computer has an SSH key, but that SSH key is associated with another Heroku account.
If you need to use both accounts for different applications on the same computer you should make a new SSH key on your machine and upload it to Heroku:
$ ssh-keygen
Make sure to save it as '/Users/User/.ssh/new_id_rsa.pub' when the prompt asks you.
$ heroku keys:add /Users/User/.ssh/new_id_rsa.pub
You then need to add an alternate host for heroku.com
to your ~/.ssh/config
:
Host heroku-altHostName heroku.comIdentityFile ~/.ssh/new_id_rsa
And then update the .git/config
in your project to use the host alias:
[remote "heroku"] url = git@heroku-alt:myapp.git fetch = +refs/heads/*:refs/remotes/heroku/*
By choosing between heroku
and heroku-alt
in the remote of the .git/config
files of specific projects you can manage which projects use which credentials.