Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

heroku

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?

like image 958
Chris Yin Avatar asked Nov 13 '12 04:11

Chris Yin


1 Answers

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.
like image 174
VonC Avatar answered Sep 24 '22 11:09

VonC