Try all of the helpful answers found here.
For me, I had two different heroku accounts, each associated with a different git repository. So I had to tell heroku to use specific SSH key for each one (apparently, not just the first available one, which seems to be the default behavior). The exact method that worked for me was following the steps here and then here.
The details:
Create a new rsa key: Specify any email you want and choose a name that will be easy for you to remember and associate with the specific heroku app. Or you could name it something like /id_rsa_herokualt.
$ ssh-keygen -t rsa -C "youremail[at]domain.com" -f ~/.ssh/id_rsa_myherokuapp
Add to your machine: Make sure to type in the exact file name as you just specified it in the last step.
$ ssh-add ~/.ssh/id_rsa_myherokuapp
Add to Heroku: This assumes you have already logged into heroku using heroku login
.
$ heroku keys:add ~/.ssh/id_rsa_myherokuapp.pub
Add an alternate host for heroku.com to your ~/.ssh/config. Locate this file by going to Finder and pressing command + shift + g and typing in ~/.ssh/. Open the Config file in a text editor, add the following text, and then save it:
Host heroku-alt
HostName heroku.com
IdentityFile ~/.ssh/id_rsa_myherokuapp
Update the .git/config in your project to use the host alias. Locate this file by going to Finder and pressing command + shift + g and typing in ~/path/to/your/repository/.git. Open the Config file in a text editor, add the following text, and then save it:
[remote "heroku"]
url = git@heroku-alt:myherokuapp.git
fetch = +refs/heads/*:refs/remotes/heroku/*
Explanation: 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.