6

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?

Michael
  • 10,124
  • 1
  • 34
  • 49
Chris Yin
  • 761
  • 1
  • 11
  • 23

2 Answers2

4

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.
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • was constrained on time, and just switched machines. am heading on the road again soon with this machine, and will try your solution then. thanks for the help! – Chris Yin Nov 15 '12 at 02:01
2

You're using Git to push your changes, and Git uses SSH, not Heroku.

From my experience, running heroku keys is not going to give your information about the identities loaded into your SSH authentication agent. For that, you need to run ssh-add -l, which will list all the identities' fingerprints loaded into it.

To load one identity into your SSH authentication agent, you need to run: ssh-add -K ~/.ssh/your_private_key. Using -K will store your passphrase in your keychain.

This will work, if you also have your public key in the remote Heroku server, of course.

Luis Ortega Araneda
  • 865
  • 1
  • 12
  • 26