8
votes

Before you tell me to refer to the similar questions, I've literally tried all of their answers and did my own research online (even though I am new to this). When I try to push the latest changes to Heroku with

git remote add heroku [email protected]:reviews.git

and then

git push heroku master

I get the following:

Macintosh-84:reviews dk1552$ git push heroku master
!  Your key with fingerprint 2c:4e:7b:df:02:7e:18:c8:2a:16:04:bc:59:5b:88:98
   is not authorized to access reviews.

fatal: The remote end hung up unexpectedly

I've set up keys, removed them, changed them, etc. All my folders/files are in Users/Dennis/...

One file I am updating for example is located in: Users/Dennis/reviews/app/views/static_pages/about_us.html.haml

What do I need to do to fix this?

4
Could you add the output of ssh -Tv [email protected] to your question? (I'm not sure it will actually help, since it looks like a config issue on the heroku side, but it is still a good sanity check.)Douglas
One common way to see that error is pushing to an app you do not own. It is also possible that the owner of reviews has removed you as a collaborator. If you do heroku info do you see reviews?Will
When I type ssh -Tv [email protected] I get: Macintosh-84:~ dk1552$ ssh -Tv [email protected] OpenSSH_5.2p1, OpenSSL 0.9.8r 8 Feb 2011 debug1: Reading configuration data /etc/ssh_config debug1: Connecting to heroku.com [50.19.85.154] port 22. debug1: Connection established. debug1: identity file /Users/Dennis/.ssh/identity type -1 debug1: identity file /Users/Dennis/.ssh/id_rsa type 1 debug1: identity file /Users/Dennis/.ssh/id_dsa type -1 debug1: Remote protocol version 2.0, remote software version Twisted debug1: no match: Twisted debug1: Enabling compatibility mode for protocol 2.0user1175844
debug1: Local version string SSH-2.0-OpenSSH_5.2 debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr hmac-md5 none debug1: kex: client->server aes128-ctr hmac-md5 none debug1: sending SSH2_MSG_KEXDH_INIT debug1: expecting SSH2_MSG_KEXDH_REPLY debug1: Host 'heroku.com' is known and matches the RSA host key. debug1: Found key in /Users/Dennis/.ssh/known_hosts:2 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS receiveduser1175844
debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering public key: /Users/Dennis/.ssh/id_rsa debug1: Server accepts key: pkalg ssh-rsa blen 277 debug1: Authentication succeeded (publickey). debug1: channel 0: new [client-session] debug1: Entering interactive session. shell request failed on channel 0 Macintosh-84:~ dk1552$user1175844

4 Answers

13
votes

See https://stackoverflow.com/a/9070685/664833 and run ssh-add -d then try pushing again.

Also try https://stackoverflow.com/a/8803103/664833 (create a new key-pair and add upload the public key to Heroku).

5
votes

If you have mixed your accounts and run into this problem, an easy workaround is to invite the yourself as a collaborator under your other email to the heroku app.

3
votes

One time this happened to me and I realized that I (having multiple Heroku accounts) used one account to initialize the Git and another to push the changes. Obviously this would create issues with your public key.

If that's the case for you either remove the .git/.gitignore directories and re-initialize with your preferred account, or sign in with the Heroku account that you used to init the Git and push the changes using that one.

2
votes

I ran into a similar issue when I created another Heroku app in a directory where git already had a working remote to an existing repository in Heroku. I kept getting the exact same error message regarding the fingerprint. So what I was trying to do was to create another environment for my web application.

By issuing these commands I was able to push to the remote again. Note that the keys:add command gives a list of available public keys. Choose the correct key that is associated with the account you are going to use (that has the application associated to it).

  • heroku keys:add - Choose the correct public key from the list for uploading to Heroku.
  • heroku accounts:set <account name>

Now try git push heroku master again and the problem should be gone.

My setup uses the accounts add-on as well. and I've got several Heroku accounts configured on my machine.