remote: No supported authentication methods left to try!

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Summary

There are several ways to get this error.  One way is when trying to authenticate with SSH on Windows with Sourcetree.  The other way is on a command line where you see this output.

git@bitbucket.org: Permission denied (publickey).


To fix this error:

  • Check that Pageant is running and has a key loaded.

  • Check that you've added the corresponding public key to your Bitbucket account.

Environment

Error possible on any ssh session to Bitbucket.

Diagnosis

The best way to diagnose this issue is to use a terminal.  Then run one of these two commands:

ssh -v -i ~/.ssh/backup/id_rsa -T git@bitbucket.org #OR
GIT_SSH_COMMAND="ssh -v" git clone git@bitbucket.org:<workspace>/<repo> # This can be any git command. 

End output from ssh command:

...
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/user/.ssh/id_rsa RSA SHA256:QULC4OxN+xrTeFFM9KwidRl2DA6Giw2m9yC5MTOJ4LE explicit
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
git@bitbucket.org: Permission denied (publickey).
$

End output from git command:

...
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/user/.ssh/backup/id_rsa RSA SHA256:QULC4OxN+xrTeFFM9KwidRl2DA6Giw2m9yC5MTOJ4LE explicit
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
git@bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.

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


Cause

  1. The workspace or the repository does not exist. Or the repository does not exist in the defined workspace.
  2. The public SSH key has not been registered with any users.  
  3. The SSH key has been registered to a user who does not have read permission to the repository.

Solution

Here are the solutions to the above causes:

  1. Using the git verbose command mentioned above, we should be able to identify if the corresponding SSH key is added onto the repository. We can follow the below steps to identify if the SSH key fingerprints match. 
    1. Cross check the SSH key fingerprint from the verbose logs with the SSH key added in the repository or workspace. 
    2. SSH key fingerprint can be compared using the following method -
      1. Copy the SSH public key added on the repository or workspace to a file on Linux or gitbash terminal 
      2. Save the SSH public key in a file as "Testkey.pub"
      3. Run command as below

        $ ssh-keygen -lf Testkey.pub              
        3072 SHA256:JPB6D/HcbNNjHddFfYQhLe0g1iJ8j15oh2NFjCCFMBY bkandula@C02FW2P5MD6R (RSA)
      4. Compare the fingerprint from the below output with the SSH fingerprint shown in the GIT SSH verbose output. 
  2. Verify if the corresponding SSH key is added on the repository or the workspace or the account's personal settings
Last modified on Mar 21, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.