Atlassian / BitBucket Sourcetree SSH Public Key Denied

To whom may have the same issue on Mac with new Sierra. Solution would be to add private key to SSH agent via:

ssh-add -K ~/.ssh/id_rsa

It looks like that identity[id_rsa] doesn’t persist by SSH agent.

Note this is not a permanent solution .. You would need to do that each time you clone a new repository.At least then no need to provide private key for each push to remote.

——– Update 28.Sep.2017 ——–

Permanent solution ( On Sierra):

Steps:

1- Be sure that you have a running ssh-agent in background before doing anything.

To check if ssh-agent is running by:

pgrep 'ssh-agent'

That command returns PID (ProcessID) of that process if it’s running.
If you see a value.. Go to Step#2. if not, so you need to run that agent in background by:

eval "$(ssh-agent -s)"

2- Edit ~/.ssh/config (Create if it doesn’t exist as su ):

Host *
 AddKeysToAgent yes
 UseKeychain yes
 IdentityFile ~/.ssh/id_rsa

3- Then add that key agent ( that would be once ):

ssh-add -K ~/.ssh/id_rsa

That’s it.

Actually Step#2 is the crucial one. I just want to provide a complete guide.

I hope that may help you.’.

Leave a Comment