8

(on Mac) I'm trying to clone my project from my new computer. I first generated the ssh key pairs:

heroku keys:add /Users/y/.ssh/heroku_rsa.pub

heroku keys shows:

ssh-rsa AAAAB3NzaC...B9DjpXg3fb y@server.local

When I try to clone my project by git clone git@heroku.com:xyz.git

Cloning into xyz...
Warning: Permanently added the RSA host key for IP address '50.19.85.132' to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

This is strange.

EDIT: If I don't rename my pub key file then it works. Somehow heroku doesn't like renaming my keys.. in other words, use the deault id_rsa.pub name.

Morrowless
  • 6,856
  • 11
  • 51
  • 81
  • Do you have `%HOME%` defined to `C:/Users/y`? (do you have `%HOME%` defined at all?) – VonC Sep 05 '11 at 08:46
  • did you add the private key to your `~/.ssh/authorized_keys` (or wherever your SSH server looks for it). It not, the SSH server won't know what to do w/ a private key authentication. – Tarek Fadel Sep 05 '11 at 08:52
  • I don't have a authorized_keys file. I never had do write to such a file on my previous machine. – Morrowless Sep 05 '11 at 09:27

3 Answers3

15

I had a similar problem. At first, I did not have a key called id_rsa.pub. I only had a key for github: github_rsa.pub. I ran heroku keys and saw that it did recognize that I had a key. But apparently heroku does not like that github key. Here's what I did:

$ssh-keygen -t rsa
$heroku keys:clear
$heroku keys:add 
$git clone git@heroku.com:my-app.git -o heroku

This downloaded all the files for the project successfully.

gstroup
  • 1,064
  • 8
  • 16
  • and guess what ... it keeps telling me after this .. Cloning into 'strong-spring-610-218'... ! No such app as strong-spring-610-218. fatal: The remote end hung up unexpectedly – Master345 Jun 03 '12 at 17:08
  • if you already have keys, you don't have to do: $ssh-keygen -t rsa so skip that step; start with $heroku keys:clear; then $heroku keys:add and it will prompt with a list of your keys to add; don't select the github one - in my case I chose: id_rsa.pub; then ran that last line to clone my app - all good thanks gstroup! – headwinds Sep 16 '12 at 04:42
  • 1
    so awesome, heroku keys:clear then keys:add was just what i needed, thanks! – FireDragon Jan 08 '13 at 08:08
9

It looks like your key is not loaded. Only default named key (id_rsa) loaded by default. Load the heroku key by using ssh-add command:

ssh-add ~/.ssh/heroku_rsa
Dmitry Maksimov
  • 2,861
  • 24
  • 19
1
heroku git:clone -a "your_project_name_on_heroku"

This simple command works fine (provided that your ssh key is correctly added before)

K M Rakibul Islam
  • 33,760
  • 12
  • 89
  • 110