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

bitbucket, ssh, ssh-keys

Solution

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

Host bitbucket.org
  IdentityFile ~/.ssh/id_rsa

When you run

ssh git@bitbucket.org

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 )

Problem

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 git@bitbucket.org ``` 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.

Original source