0
votes

I'm trying to push to heroku but am getting a permission denied error. I've followed the articles from these locations:

https://devcenter.heroku.com/articles/keys

Permission denied (publickey) when deploying heroku code. fatal: The remote end hung up unexpectedly

But those aren't working out.

Here is the output from shell to show what I'm trying to do:

[root]# heroku keys
  You have no keys.
[root]# heroku login
  Enter your Heroku credentials.
  Email: [email protected]
  Password (typing will be hidden): 
  Found the following SSH public keys:
  1) github.pub
  2) heroku.pub
  Which would you like to use with your Heroku account? 2
  Uploading SSH public key /root/.ssh/heroku.pub... done
  Authentication successful.
[root]# git init
  Reinitialized existing Git repository in /.git/
[root]# git push heroku master
  Permission denied (publickey).
  fatal: The remote end hung up unexpectedly

Edit: This is for a CentOS server.

2
Are you on a Mac? Are you using a key manager like ssh-agent?redhotvengeance
I am on Mac but this is on a CentOS server.Peter
Even still, is ssh-agent being used?redhotvengeance

2 Answers

1
votes

I figured it out.. I guess you actually need to use id_rsa instead of a custom one.. soon as I ran ssh-keygen -t rsa -f id_rsa it worked. Go figure.

0
votes

For future visitors, I add another answer (following @redhotvengeance comment above) which does not require that you use id_rsa for your heroku key. The following series of commands launches the ssh-agent and adds your heroku key so that push becomes successful:

ssh-agent
ssh-add ~/.ssh/my_heroku_key
# now it should work
git push heroku master

And it's working nicely.