ssh key not accepted by Bitbucket

John Lawlor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 25, 2020

When I do a 'git pull' on a repository I get this:

[user@localhost fw]$ git pull 
git@bitbucket.company.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

If I try and add my public key to Bitbucket I get this:

Screenshot_20201125_141246.pngI have tried regenerating the key, and I get the same problem.

 

 

2 answers

1 accepted

0 votes
Answer accepted
John Lawlor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 6, 2020

This is due to a bug in the OS I am using, Fedora 33

https://bugzilla.redhat.com/show_bug.cgi?id=1884920

The workaround is to update ~/.ssh/config with the following:

Host <insert hostname of your bitbucket server>
 PubkeyAcceptedKeyTypes +ssh-rsa

 

Thanks for your help Ana.

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 30, 2020

Hi @John Lawlor, thanks for reaching out!

The error you're getting is not necessarily related to your SSH key. Are you pulling from a repository you own, or is it someone else's repository? If it's someone else's repository, please make sure you the right permissions, otherwise you won't be able to pull.

Regarding the keys, I've checked the Bitbucket Cloud account associated with this Community account and I could see that you have several SSH keys associated with it. When you try to add a new one, please make sure you're copying the contents of the new key you just created, and are not copying an existing key by accident. If you're adding a new key, you shouldn't be facing any issues 🙂

Another thing that would help you narrow down the problem is trying to pull a different repository and checking if you have any inconvenience. 

If you have the right permissions, and you're certain you're adding a new key and you're still having trouble, let us know so we can continue assisting you on this. 

 

Best regards,

Ana

John Lawlor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 30, 2020

Hi Ana,

Thanks for getting back to me. This is not Bibucket Cloud, it's Bitbucket Server. The repository is one that I have pulled from lots of times before. In fact, I can't pull from any repository that I have used before. They all complain about the public key.

I am using git client version 2.28.0 and Bitbucket Server 7.5.0

 

Regards

John

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events