14

So I'm trying to deploy my app to heroku but it keeps giving me this error whenever I push to master:

! Your key with fingerprint cb:e1:5c:31:cd:6b:78:6e:30:ff:eb:11:e2:4b:2e:b3 is not authorized to access smooth-mountain-8970.

I tried everything from generating new ssh keys to deleting everything and replacing the files. I even created a different username and tried uploading, but it keep giving me this error thinking that I want to upload to smooth-mountain when in fact, my app name is NOT smooth-mountain. Do you guys know what the problem might be?

Thanks.

Nosayr Yassin
  • 419
  • 1
  • 6
  • 15

5 Answers5

27

ssh-agent (a program that holds private keys used for public key authentication) runs automatically since Mac OS X Leopard. To resolve your problem you must remove identities from the agent by issuing the following command.

ssh-add -d

Example:

> ssh-add -l 
1024 a3:d5:21:2d:50:ee:3e:af:1b:44:62:60:1d:e4:51:21 /Users/bart/.ssh/id_dsa (DSA)

> ssh-add -d 
Identity removed: /Users/bart/.ssh/id_dsa (/Users/bart/.ssh/id_dsa.pub)

> ssh-add -l 
The agent has no identities.

This will only remove the keys from this session temporarily. Personally, I don't mind doing this once in a while. However, if you would like disable ssh-agent permanently, see: SSH Key Disable Caching

user664833
  • 18,397
  • 19
  • 91
  • 140
  • 3
    In my case since I used a different key for Heroku (my id_rsa was already on file with my work account) I had to `ssh-add -d` then `ssh-add /Users/blah/.ssh/id_heroku`. – cfeduke Feb 20 '12 at 01:39
4

After I rename my app at Heroku.com, I had the problem:

 !  Your key with fingerprint xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx is not authorized to access smooth-rain-5917.

fatal: The remote end hung up unexpectedly

I was try almost everything ... as @Nosayr Yassin, said ...

I don't have any .config file, but I found the wrong reference at

my_app_root_dir/.git/config

it's contains

[remote "heroku"]
        url = git@heroku.com:smooth-rain-5917.git
        fetch = +refs/heads/*:refs/remotes/heroku/*

I changed for:

[remote "heroku"]
        url = git@heroku.com:my_new_app_name.git
        fetch = +refs/heads/*:refs/remotes/heroku/*

Then, run agian

git push heroku master

and that's it, I finally can re-deploy my app again ...

thks for all your tips :P

Rgds iVieL

edited: btw, I running on OSX Lion :)

Vielinko
  • 1,659
  • 1
  • 13
  • 17
2

In my case,

heroku keys

Did show me my correct key, but I still couldn't push to Heroku.

This is what worked for me:

ssh-add -d
heroku keys:add ~/.ssh/id_rsa_heroku.pub

That is, it worked for me yesterday, but today... it did not.

This is what worked today, thanks to help from my Unix-master boss:

ssh-add ~/.ssh/id_rsa*
cd ~/.ssh
ls -l
chmod 600 id_rsa*
chmod 644 *.pub
ls -l
ssh-add id_rsa
ssh-add id_rsa_heroku
cd -
schatzkin
  • 319
  • 3
  • 17
1

Solved this kind of problem just by typing in local shell

heroku accounts:set accountname

where accountname is the name of the account that holds the Heroku app. After that git push heroku master works fine. Didn't have to do anything else.

Looks like many have run into this problem with multiple accounts, so I thought I'd share this. I'm myself managing multiple accounts (on a single machine) of which each has multiple apps deployed. I've installed the heroku-accounts plugin for Heroku CLI. (https://github.com/ddollar/heroku-accounts)

tukkaj
  • 596
  • 1
  • 6
  • 16
1

I found an easier solution via Heroku Devcenter. Here's what I did to get it working properly.

ssh-keygen -t rsa

It will generate the public/private rsa key pair. If you already have one then pass n for no.

heroku keys:add

It will find existing public key and upload the SSH public key.

That's it. It was that easy.

Rahul Roy
  • 473
  • 1
  • 6
  • 17