Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git clone heroku ssh permission denied

I just bought a new computer and I am trying to clone my heroku project on it.

Here's what I've done so far. I didn't include the trace, but everything was saved in the right place, and the functions ran without errors.

>> sudo ssh-keygen
>> heroku keys:add
>> sudo git clone -o heroku [email protected]:myapp.git

Initialized empty Git repository in /Users/macuser/Sites/shwagr/shwagr/.git/
Permission denied (publickey).

Then I heard about doing it through ssh bash..

>ssh-agent bash
>ssh-add ~/.ssh

Permissions 0777 for '/Users/macuser/.ssh' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.

What? Ok Dad..

>>sudo chmod 700 ~/.ssh
>>ssh-agent bash
>>ssh-add ~/.ssh
Enter passphrase for /Users/macuser/.ssh: 
Bad passphrase, try again for /Users/macuser/.ssh: 
Bad passphrase, try again for /Users/macuser/.ssh: 
Bad passphrase, try again for /Users/macuser/.ssh: 
Bad passphrase, try again for /Users/macuser/.ssh: 
Bad passphrase, try again for /Users/macuser/.ssh: 
Bad passphrase, try again for /Users/macuser/.ssh:

Not sure what the password here is, but it sure wasn't me who set this one. If I simply press return/enter, it exits out, but that doesn't give me the impression it worked. And consequentially, it still doesn't allow me to clone the repository.

Any ideas?

UPDATE I went into my ~/.ssh file and performed ssh-keygen -t rsa and i made a new key called love. Then I heroku keys:add love.pub successfully.

Then I went to git clone..

sudo git clone -o heroku [email protected]:mysite.git

Initialized empty Git repository in /Users/macuser/Sites/shwagr/shwagr/.git/
Permission denied (publickey).

UPDATE 2

I deleted ~/.ssh, and recreated it without sudo. Then I removed all my keys I had created today off of heroku , and restarted the process.

Same error.

Update 3

>>heroku keys

  No Keys for this computer.

>>sudo heroku keys

  No Keys for this computer

>>heroku keys:add

>>heroku keys

ssh-rsa AAAA...J67lw== [email protected]

Compared these keys to my keys : They are identical. :D

Permission Denied.

Attempt 4

heroku keys:clear rm -rf ~/.ssh mkdir ~/.ssh cd ~/.ssh ssh-keygen -t rsa heroku keys:add cd /Users/macuser/Sites/ sudo git clone -o heroku [email protected]:shwagr.git

Failed.

fatal: The remote end hung up unexpectedly

Huge Update

Just found out that git repo is actually empty. And it's just a symbolic link ( when you attach a real domain to it it still uses the old one as the real repo ). So when I pulled one of Heroku's default names like smooth-buttery-back-52.git , it pulled and worked, and was actually my repository.

like image 747
Trip Avatar asked Aug 28 '10 14:08

Trip


People also ask

How do I fix Git permission denied?

Always use the "git" user $ ssh -T [email protected] > Permission denied (publickey). If your connection failed and you're using a remote URL with your GitHub username, you can change the remote URL to use the "git" user. You should verify your connection by typing: $ ssh -T [email protected] > Hi USERNAME!

How do you please make sure you have the correct access rights and the repository exists?

The “Please make sure you have the correct access rights” error occurs if you do not have the right permissions to access a Git repository. To solve this error, make sure you are referring to the correct remote URL and that you have set up SSH authentication correctly.


1 Answers

I followed the steps provided by heroku and it worked. Once you have generated ssh keys (it does not matter what you call the files), just do the following:

> heroku login
> heroku keys:add

The first statement prompts you for your heroku userid/password. Once you are authenticated, running the second command picks all your public keys and pushes it out to heroku.com. After that you can run git clone and it will work like a charm!

like image 111
Tabrez Avatar answered Sep 17 '22 19:09

Tabrez