It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Permission denied (publickey)

Baptiste Augrain Jun 07, 2017

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

4 answers

1 accepted

39 votes
Answer accepted
Baptiste Augrain Jun 08, 2017

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...

Nilesh Jaiswal Jan 07, 2018

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

Ben Feb 03, 2018

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

Guy Silva Feb 05, 2018

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

Umar Farooq Mar 06, 2018

thnx my issue fix by above work.

vicentkarl Apr 14, 2018

thanks a lot!!!!

Sam Morala Apr 21, 2018

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

Murray Collingwood Jun 13, 2018

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 

Like Richard Vander Reyden likes this
Ralph Ngo Aug 15, 2018

This solves my issue for ages!

Patrik Roh Nov 21, 2018

This worked like a charm, thank you!

Javier Garrido I'm New Here Dec 29, 2018 • edited

Thanks.

Arildo Junior Feb 15, 2019

If I restart the computer I need to do this again, how to avoid this?

Baptiste Augrain Feb 15, 2019

@Arildo Junior you only need to do it once.

Andrew Blair May 13, 2019

Worked for me but I only needed to do the first step, 

ssh -Tv git@bitbucket.org
Like Andrey Pakharchuk likes this
0 votes
Jim Redmond Atlassian Team Jun 07, 2017

Which operating system are you using?

Baptiste Augrain Jun 07, 2017

macOS v10.11.6

andrew kerr Jun 07, 2017 • edited

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.

Christian Schober Sep 28, 2018

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

0 votes
Aftab Ahmed Minhas I'm New Here Jan 28, 2019

I have to push my repository to bitbucket but whenever i try to push it or clone my local repo with server it gives me error "permission denied(publickey)" i am using git tortoise on windows 8... any idea what i am doing wrong???

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Sourcetree

[dev team] Sourcetree for Windows 2019 Preview - Dark Theme

Hi folks, While the full post is over on our blog I'd like to share the dark theme we've got planned for 2019 here directly as well to keep the discussion going.  The ...

1,941 views 14 18
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you