Heroku - Added SSH public key and still getting Permission denied (publickey) error

git, heroku

Solution

Maybe the ssh session doesn't know where to find the private key associated to your public key, which can happen if `%HOME%` isn't defined to `C:/Users/Chris`. (and remember, `HOME` isn't defined by default on Windows)

You can:

- make sure HOME is set

- define a `%HOME%/.ssh/config` file

Host heroku
Hostname heroku.com 
Port 22 
IdentitiesOnly yes 
IdentityFile /C/Users/Chris/.ssh/id_rsa # location and name of your private key
TCPKeepAlive yes 
User git

- under a bash session, check the permissions (for `.ssh` and the keys).

- clone the heroku repo: `git clone heroku:yourRepo`

- make some commits and push from there.

Problem

Uploaded to Heroku many times before and don't know what's wrong this time-- maybe it's because I'm using public internet? Anyway, so I added a new public key with ``` >heroku keys:add Found existing public key: C:/Users/Chris/.ssh/id_rsa.pub Uploading SSH public key C:/Users/Chris/.ssh/id_rsa.pub...done >git push heroku master Permission denied (publickey). fatal: The remote end hung up unexpectedly ``` Why can't I push to heroku? I checked my keys heroku keys and my terminal came up correctly, so it should be working. Anyone shed some light?

Original source