Permission denied (publickey)

Hi,

I'm using SourceTree v2.5.2 (111) to clone and push to Bitbucket.

When I trying the clone a project or to push, I'm getting the error:

Please make sure you have the correct access rights
and the repository exists.
Permission denied (publickey).
fatal: Could not read from remote repository.

I've tried to re-add the account, checked the ssh key, I'm still getting the error.

Any thought? Can anybody help me?

 

Thx

3 answers

1 accepted

22 votes
Accepted answer

Hi,

I was able to fix it!

I've tried to re-authorize SourceTree in the OAuth or regenerate the ssk key with `ssh-keygen`. Both didn't worked.

I did follow the documentation configure-multiple-ssh-identities-for-osx-linux

$ ssh -Tv git@bitbucket.org
OpenSSH_6.9p1, LibreSSL 2.1.8
...
Permission denied (publickey).

$ ssh-add -l 
2048 SHA256:... /Users/user/.ssh/id_rsa (RSA)

$ ssh-add ~/.ssh/user-Bitbucket
Enter passphrase for /Users/user/.ssh/user-Bitbucket: 
Identity added: /Users/user/.ssh/user-Bitbucket (/Users/user/.ssh/user-Bitbucket)

$ ssh-add -l 
2048 SHA256:... /Users/user/.ssh/id_rsa (RSA)
2048 SHA256:... /Users/user/.ssh/user-Bitbucket (RSA)

$ ssh -Tv git@bitbucket.org
OpenSSH_6.9p1, LibreSSL 2.1.8
...
logged in as user.

Then, I was able to push my commits. It's working!

The issue might have come after the reboot of the mac. The first one since I had install SourceTree v2.5.2 (110) for a better support of OAuth...

Thank You,  I had the same issue and this was helpful.  

I had the same issue in the same scenario (after reboot I think) and this resolved it.  Thank you!

same issue here. The solution worked like a charm!
thanks

thnx my issue fix by above work.

thanks a lot!!!!

I had the same issue, and this solution saved me a time and energy :D thank you very much.

I had this problem and this solution worked.

I am on Sourcetree 2.7.3 (no recent updates).

Problem happened after an OSX update to High Sierra, osx 10.13.5 

This solves my issue for ages!

This worked like a charm, thank you!

0 votes
Jim Redmond Atlassian Team Jun 07, 2017

Which operating system are you using?

Same occurs for me. Has happened since the upgrade to 2.5.2. Switched back to https however that keeps asking for my password constantly. Atleast I can work though.

I've also switched to GitKraken which has no issues with the same repos and ssh. Might be worth switching everything over.

Thank you very much, the solution proposed in this post https://www.flynsarmy.com/2017/09/fix-permission-denied-publickey-git/ worked for me!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

841 views 3 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you