Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't push to bitbucket, Permission denied (publickey)

I am trying to push my project onto my bitbucket, been messing with this for about 4 days pouring through countless problem solving/pages/troubleshooting/tutorials. Im at a loss and very frustrated. I have done this before but on different computers...anyway here is the code/response that I'm getting

~/dev/sample_app git push -u origin --all The authenticity of host 'bitbucket.org (131.103.20.168)' can't be established. RSA key fingerprint is 81:7b:2c:f5:6f:18:2b:7c:4b:ec:aa:46:46:74:7c:40. Are you sure you want to continue connecting (yes/no)?  Host key verification failed. fatal: Could not read from remote repository.  Please make sure you have the correct access rights and the repository exists. ~/dev/sample_app  

I am on a mac running 10.8.4.

So a little progress has been made, initially there was no .ssh folder so I created that way back in the beginning, there was no known_hosts file so I ran

ssh -T [email protected] 

I chose yes and this created a known_hosts file and when I tried to push again I got:

~/dev/sample_app git push -u origin --all Permission denied (publickey). fatal: Could not read from remote repository.  Please make sure you have the correct access rights and the repository exists. 

My .ssh folder is 700 and the keys inside are all 600.

like image 618
josephleon Avatar asked Jul 14 '13 21:07

josephleon


People also ask

What does permission denied mean in Bitbucket Cloud?

Permission denied (publickey). remote: Permission denied (publickey). abort: no suitable response from remote hg! You are receiving this message because Bitbucket Cloud could not authenticate you with any of the keys that were offered to it by your SSH agent. To verify this is the case, do the following

What does permission denied (publickey) mean?

remote: Permission denied (publickey). abort: no suitable response from remote hg! You are receiving this message because Bitbucket Cloud could not authenticate you with any of the keys that were offered to it by your SSH agent. To verify this is the case, do the following This will attempt to create a connection to Bitbucket Cloud for Mercurial.

Why can't I see my public key in Bitbucket Cloud?

This can be caused by a couple of factors, but these are the most common: To check to see if your public key is loaded into Bitbucket Cloud, do the following: Open a browser and log into Bitbucket Cloud. Choose Your avatar > Bitbucket settings from the menu bar. The system displays the Account settings page. Click SSH keys in the Security section.

Why can't I push to a specific Repository in Bitbucket?

replace bitbucket.org with your own bitbucket host. This deploy key has read access to the following repositories: that is why pushing to the repository is not working. This you can also double check in the Bitbucket Web UI, notice the read-only access in the description: Hope this gives a different perspective to the same problem.


1 Answers

You can set IdentityFile flag file in ~/.ssh/config file as follows:

Host bitbucket.org   IdentityFile ~/.ssh/id_rsa 

When you run

ssh [email protected] 

the ssh client allows you to selects a file from which the identity (private key) for RSA or DSA authentication is read.

SSH Client To Use Given Private Key ( identity file )

like image 199
cyb0k Avatar answered Oct 04 '22 20:10

cyb0k