7

I am deploying an app on Heroku so I created a Heroku app from a repo and then did git push heroku master. When I do this it keeps giving me the error:

!  Your key with fingerprint xxx is not authorized to access heroku-app.

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I tried various things with changing my SSH keys including deleting them all and creating new ones. Still it gives me the same error. I have added the key to Heroku.

Then I tried running ssh -vT git@heroku.com:heroku-app.git and the result was:

OpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 53: Applying options for *
ssh: Could not resolve hostname heroku.com:heroku-app.git: nodename nor servname provided, or not known

I cannot figure out what that error is pointing to. The hostname is definitely valid. Is it possible I am don't have something I need in the SSH config file? Any ideas would be fantastic because I have spent quite a few hours today trying to get this to work without avail.

chromedude
  • 4,246
  • 16
  • 65
  • 96
  • I get the same error if I do ssh that way. So try this: do `git remote show origin`. You'll need your github username and password. – Michael Durrant Jan 03 '13 at 03:13
  • @MichaelDurrant Hmm... I get this error: `fatal: 'origin' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.` – chromedude Jan 03 '13 at 03:16
  • ok, now please type `git remote show` – Michael Durrant Jan 03 '13 at 03:37
  • oh, please make sure you are in the root directory of your application - so please type `pwd` at the command line. – Michael Durrant Jan 03 '13 at 03:38
  • @MichaelDurrant Ok. I did that before. There is a remote set for heroku – chromedude Jan 03 '13 at 03:40
  • Please do `ssh -T git@github.com` – Michael Durrant Jan 03 '13 at 04:11
  • Also, please type `host heroku.com` – Michael Durrant Jan 03 '13 at 04:13
  • @MichaelDurrant the first said I was officially authed with Github and the second gave me this: `heroku.com has address 50.19.85.132 heroku.com has address 50.19.85.154 heroku.com has address 50.19.85.156 heroku.com mail is handled by 10 aspmx.l.google.com. heroku.com mail is handled by 10 aspmx2.googlemail.com. heroku.com mail is handled by 10 aspmx3.googlemail.com. heroku.com mail is handled by 10 aspmx4.googlemail.com. heroku.com mail is handled by 10 aspmx5.googlemail.com. heroku.com mail is handled by 10 alt1.aspmx.l.google.com. heroku.com mail is handled by 10 alt2.aspmx.l.google.com.` – chromedude Jan 03 '13 at 04:23

2 Answers2

9

git@heroku.com:heroku-app.git is an SCP format for this ssh address.

It relies on a ~/.ssh/config file with a 'heroku.com' entry, which specify the user, the actual hostname, and if needed, the private/public key path.

host heroku.com
     user git
     hostname heroku.com
     identityfile ~/.ssh/yourPrivateKey

Again: heroku.com in 'heroku.com:heroku-app.git' is not an hostname: it is an entry in an ssh config file.
You could replace heroku.com by xxx: git push xxx:heroku-app.git, provided you have an xxx entry in the ~/.ssh/config file.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • ah... That makes total sense. I thought there might be something up with the config file, but I had never worked with it before. Thank you so much!!! – chromedude Jan 03 '13 at 14:49
  • 2
    @chromedude You are most welcome. Don't forget you won't need to use '`git`' in '`git@heroku.com:...`', since the user '`git`' is specified in the `~/.ssh/config` file. so a `git push heroku:heroku-app.git` should be enough (I would recommend an entry named `heroku`, instead of `heroku.com`, just to be sure to not mix it with an hostname) – VonC Jan 03 '13 at 15:33
0

It also be as simple as:

  1. $ heroku login
  2. $ heroku git:clone -a appname ( this line right here solved it for me)
  3. $ git add .
  4. $ git commit -am "make it better"
  5. $ git push heroku master

after making sure $ heroku git:remote -a appname (has not name conflict between heroku and git)

Alwan Mortada
  • 278
  • 3
  • 10