4

While there are many questions about this error, all of them have to do with an app created by the person getting the error, and haven't helped solve my problem. I have been added as a collaborator on an app on heroku. When I try to clone the heroku repository through

git clone git@heroku.com:myapp.git -o heroku

or if I clone the code it was based of off from github and run

git push heroku master (after doing git add and git commit)

it give me the error "Your key with fingerprint (...) is not authorized to access myapp." I have tried various combinations of heroku keys:add, heroku keys:clear, and ssh-keygen.

The other collaborators on this app have had no issues pushing to heroku.

ShayBlair
  • 41
  • 4
  • 1
    This SO duplicate has a few answers: http://stackoverflow.com/questions/8786564/cannot-push-to-heroku-because-key-fingerprint – silasjmatson Nov 09 '12 at 18:37

3 Answers3

4

I got this error because I was using multiple heroku accounts:

I wanted to do this so I could 'play' independently with my own Heroku account while collaborating with others on a team/project account.

This is separate from the Heroku concept of multiple people collaborating on the team account: I wanted the team account to be the app owner for collaboration, so that my individual account could act as a less-privileged collaborator, just like the rest of the team. Only the owner gets to: Add/remove paid add-ons, Delete/rename the app, and View invoices.

For multiple account support (e.g., your own individual heroku account), you need to add this not-so-very-well-documented add-on:

$ heroku plugins:install git://github.com/ddollar/heroku-accounts.git

see: https://github.com/ddollar/heroku-accounts

This is what your git SSH setup will eventually look like:

(venv)MacPro:your_project username$ more .git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = ssh://your_username@git.your_org.com/your_project.git
[branch "master"]
        remote = origin
        merge = refs/heads/master
[remote "heroku_kb"]
        url = git@heroku.individual:your_individual_app.git
        fetch = +refs/heads/*:refs/remotes/heroku/*
[remote "heroku_ocp"]
        url = git@heroku.your_project:your_team_app.git
        fetch = +refs/heads/*:refs/remotes/heroku/*
[heroku]
        account = individual

The last three sections above define the two separate heroku remotes and specify which one is active.

The heroku-accounts add-on makes all this work by adding ~/.ssh/config entries:

Host heroku.individual
  HostName heroku.com
  IdentityFile "/Users/username/.ssh/identity.heroku.individual"
  IdentitiesOnly yes

Host heroku.your_project
  HostName heroku.com
  IdentityFile "/Users/username/.ssh/identity.heroku.your_project"
  IdentitiesOnly yes

If you don't separate the accounts out like that, one SSH key will interfere with the other and you will end up in SSH limbo like I did, having fun google/forum-chasing an error that looks like this:

MacPro:your_project username$ git push heroku master

 !  Your key with fingerprint cf:5b:6b:91:d5:71:e8:8b:73:dc:cf:86:56:fd:7a:49 is not authorized to access [insert appname here].

fatal: The remote end hung up unexpectedly
Collin
  • 11,977
  • 2
  • 46
  • 60
Kbr
  • 41
  • 2
1

It sounds like some sort of configuration issue. You really should double check you have the proper permissions on the app, and that your SSH keys are registered with heroku.

Make sure you're using the keys you think you're using. Essentially, cat ~/.ssh/id_rsa.pub (or whatever key you're using) should show up in heroku keys --long.

Read https://devcenter.heroku.com/articles/keys for more info.

Yuval Adam
  • 161,610
  • 92
  • 305
  • 395
  • How can I check the keys are registered and which ones are being used? I've looked at that site multiple times and it hasn't helped yet. – ShayBlair May 25 '12 at 22:00
1

You likely have more than one ssh key, and the wrong one is being used by default. To fix this you'll need to configure SSH to send the correct key to heroku.com. See this answer on Super User for more details.

Community
  • 1
  • 1
James Tikalsky
  • 3,856
  • 1
  • 21
  • 12