Git Permission denied (publickey)
Create ssh_config
with
Host git_hostname # probably bitbucket.org
IdentityFile /d/ssh/id_rsa
It should be in ~/.ssh/config
. You should be able to find out what configuration is your client reading when running ssh -vvv bitbucket.org
.
It can also happen when u added SSH support in your repository. And can be fixed by following steps :
Goto SSH
cd ~/.ssh
List existing Keys
ls -al ~/.ssh
Use this command to create the SSH keys
ssh-keygen -t rsa -C "[email protected]"
Use this command to start your ssh-agent if it's not already running
eval `ssh-agent`
Then add your private key file to SSH
ssh-add ~/.ssh/<private_key_file>
Copy and paste your key in Bitbucket/ Github with
cat ~/.ssh/<public_key_file> | pbcopy
Sometime it does not persists between reboot. Then you have to add below lines in .ssh/config (For Mac)
Host * UseKeychain yes AddKeysToAgent yes IdentityFile ~/.ssh/<private_key_file>