git push heroku master permission denied

The best way to avoid such errors is to use one public/private key pair and not an extra key for heroku. This way you (or your system) can't choose a wrong key to login in heroku.

If you get this error, you have done something wrong. Check this site: https://devcenter.heroku.com/articles/keys

If you geht this error, the best way is to remove unnecessary keys and use only one.

If you need more than one key pair on your system, you can set one key for heroku. This is done through the following command:

heroku keys:add

Some help for Windows 7 users with Github Windows client installed:

Even though heroku toolbelt reports it found my git_hub public key and uploaded it, 'git push heroku master' failed. After taking the steps below, it works fine.

  1. Create .ssh folder under your User folder if one does not exist. If it does, delete all files in it (this assumes you are OK with starting from scratch with ssh keys).

  2. In Windows Explorer, right click the .ssh folder, and choose Git bash from the context menu. This is installed along with the Github Windows client software.

  3. In the bash window enter ssh-keygen -t rsa -C "[email protected]" When prompted enter a passphrase (don't lose this).

  4. Close the bash shell window.

  5. From a cmd prompt in your project's root, enter heroku keys:add. This will find and upload the key you just created from your /.ssh file to Heroku.

Now you can enter git push heroku master to push you app up to Heroku. Note: you will need to add your newly generated ssh public key to your Github account when done.