Why am I not able to add an SSH key in bitbucket.org

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

When attempting to add a new SSH key in Bitbucket Cloud, you receive one of the below errors

Someone has already registered that SSH key.
SSH keys must be unique and deleted keys may take up to 30 days to be removed. Please use a unique SSH key

Cause

The SSH key you have chosen has been registered by you at some point in the past or by a colleague on a team account or might have been used in other repositories(so you will receive this error while adding it to a workspace/account) or at project level.

Only one user can register an SSH public key.  The SSH public key has to be unique for many reasons to track who did what action.  For security reasons, It is best practice for each user or process to have their own SSH key.  


Resolution

There are two options.  We highly recommend solution 1.

  1. Create a new SSH Key following the steps of the article Set up an SSH key, and after its creation, add it to your Account settings or your project settings or your workspace settings.
    • We highly recommend this option due to the small possibility that the ssh private key has leaked.  With the private key alone, you can recover the public key.
  2. Open a terminal with SSH configured to use the private ssh key for the public key you attempted to add.  If your private key matches and the public key is registered, you will be able to authenticate to Bitbucket.  This is an example of a successful Authentication.
$ ssh -i -t git@bitbucket.org
authenticated via ssh key.

You can use git to connect to Bitbucket. Shell access is disabled
$
  • Check all of your Bitbucket users to see if this key is already registered with one of the users.
  • If you are an admin for the workspace then you can visit our support portal , create a support ticket, and attach the content of the public SSH key and the file to the newly created ticket.  If the key is registered to a user in your workspace we may be able to provide you the username who has registered this key.  Otherwise, see solution 1.


Last modified on Dec 4, 2023

Was this helpful?

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