8

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 git@heroku.com: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?

Mat
  • 202,337
  • 40
  • 393
  • 406
user1175844
  • 81
  • 1
  • 1
  • 2
  • 1
    Could you add the output of `ssh -Tv git@heroku.com` 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 Jan 29 '12 at 00:36
  • 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 Jan 29 '12 at 02:22
  • When I type ssh -Tv git@heroku.com I get: Macintosh-84:~ dk1552$ ssh -Tv git@heroku.com 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.0 – user1175844 Jan 29 '12 at 23:26
  • 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 received – user1175844 Jan 29 '12 at 23:28
  • 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 Jan 29 '12 at 23:28
  • When I do heroku info, i get: Macintosh-84:~ dk1552$ heroku info ! No app specified. ! Run this command from an app folder or specify which app to use with --app Macintosh-84:~ dk1552$ cd Macintosh-84:~ dk1552$ desktop/ -bash: desktop/: is a directory Macintosh-84:~ dk1552$ cd reviews Macintosh-84:reviews dk1552$ heroku info ! You do not have access to reviews. Macintosh-84:reviews dk1552$ – user1175844 Jan 29 '12 at 23:31

4 Answers4

13

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).

Community
  • 1
  • 1
user664833
  • 18,397
  • 19
  • 91
  • 140
  • It still doesn't seem to be working. I want to confirm I'm doing it correctly though. So first I listed it all by typing ssh-add -l. Then I removed them all with ssh-add -d. Next, I made a new public key by typing ssh-keygen (and just clicked enter for all of the options) and it said: Your public key has been saved in /Users/Dennis/.ssh/id_rsa.pub. Then, when I go to add it, all I do is type the following: heroku keys:add /Users/Dennis/.ssh/id_rsa.pub Finally when I go to push it, it gives me the same error message. – user1175844 Jan 30 '12 at 21:40
  • Try just deleting the key with `ssh-add -d` and then pushing.. nothing else, and report back. – user664833 Jan 31 '12 at 01:42
  • Macintosh-84:~ dk1552$ ssh-add -d SSH_AGENT_FAILURE Could not remove identity: /Users/Dennis/.ssh/id_rsa – user1175844 Jan 31 '12 at 14:22
  • That's fine. It says that if there is no identity to remove. Just double check again, with `ssh-add -l`, whether there is an identity cached (and if there is, then remove it with `ssh-add -d`). Then try to push, and report back here. – user664833 Jan 31 '12 at 18:26
  • Still nothing: Macintosh-84:~ dk1552$ ssh-add -l The agent has no identities. Macintosh-84:~ dk1552$ ssh-add -d SSH_AGENT_FAILURE Could not remove identity: /Users/Dennis/.ssh/id_rsa Macintosh-84:~ dk1552$ git push heroku master fatal: Not a git repository (or any of the parent directories): .git Macintosh-84:~ dk1552$ cd reviews Macintosh-84:reviews dk1552$ git push heroku master ! Your key with fingerprint 1b:e5:ba:1d:dc:e2:42:fa:10:8d:4b:35:46:9a:ec:eb is not authorized to access reviews. fatal: The remote end hung up unexpectedly – user1175844 Jan 31 '12 at 20:25
  • 3
    Try `ssh-add -D` (capital d), and it should say `All identities removed.` Then try pushing again, and please report back. – user664833 Mar 16 '12 at 19:14
5

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.

jaketrent
  • 1,173
  • 11
  • 25
3

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.

Jon McIntosh
  • 1,263
  • 8
  • 14
  • I had this same issue because I didn't realize I had installed the [heroku-accounts plugin](https://github.com/ddollar/heroku-accounts) and the account (ssh keys) it was trying to use to `git push` were the wrong ones. When I reinstalled the plugin and read through the readme I was able to resolve my issues. – Andrew Jun 21 '12 at 13:59
2

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.

tukkaj
  • 596
  • 1
  • 6
  • 16
  • Great! I'd been regenerating my keys all the time until I've been your proposal. It works!! Thanks a lot. – josal Jun 25 '14 at 07:20
  • In my case, it is only needed to set the heroku account again, no need to add the keys again. Wow! – josal Jun 29 '14 at 15:22