Re-Add ssh key after more than 30 days since deletion
Asked by Jens Rosemeier:

Hi.

I had a ssh key added in my account, have it deleted back in may 2023.

Now its more than 30+ days ago, but i can still not re-add that same key to my account.  
Getting always the error message: "SSH keys must be unique and deleted keys may take up to 30 days to be removed. Please use a unique SSH key."

How can i have this solved?


Answers:
author: Theodora Boudale
body: Hi Jens,

The 30-day period applies when you delete an account, workspace, or repo that has SSH keys associated with it. In this case, since the deletion of the account, workspace, or repo, can take up to 30 days to complete, the SSH keys will also be removed in up to 30 days.

If you simply remove an SSH key from your account, without deleting the account, the removal is immediate.

Please keep in mind that an SSH key that is added to an account or a workspace cannot be added to a repository or project as well.

An access key that has been added to a repo or project can be added to multiple other repos or projects, but not to an account or workspace.

I would suggest checking your repositories and projects in case the SSH key has been added there.

If still cannot figure it out or if the number of projects and repos is big, you can create a ticket with the support team. You can share in the support ticket the public SSH key you are trying to add and we will let you know where it has been added.

You can create a ticket via <https://support.atlassian.com/contact/#/>, in "What can we help you with?" select "Technical issues and bugs" and then Bitbucket Cloud as product. When you are asked to provide a workspace URL, please make sure you provide the URL of the workspace that is on a paid billing plan, so you can proceed with ticket creation.

Please feel free to let me know if you have any questions.

Kind regards,  
Theodora

comments: author: Jens Rosemeier
body: Thx for this long explanation.

80% is helpful but not related to my request :)

I have deleted a SSH key from my account settings, now much more than 30days later, i like to readd that same key to my account but i am prevented with mentioned error message.

The public SSH key in question is as follows:

```
<key_removed_for_privacy>
```


author: Theodora Boudale
body: Hi Jens!

This SSH key is added as an Access key to a certain repository, which is the reason why you cannot add it to your account.

This is why I explained in my previous reply that an access key that has been added to a repo or project can be added to multiple other repos or projects, but not to an account or workspace.

I cannot give your the full URL of the repo as this is a public forum, but the repo URL masked is

```
https://bitbucket.org/o*******es/f***_fork
```

While you are logged in to <https://bitbucket.org>, you can see all workspaces your account has access to on this page:

* <https://bitbucket.org/account/workspaces/>

Make sure to open all workspaces to figure out which is the one with id **o\*\*\*\*\*\*\*es** . In that workspace, you can look for the repo named **f\*\*\*_fork**.

You can then view its Access keys from **Repository settings \> Access keys**.

If you want to add this SSH key to your account, you will need to remove it from this repo's Access keys first.

Please feel free to let me know how it goes.

Kind regards,  
Theodora


author: Jens Rosemeier
body: Awesome, this was helpful i was able to add my key to account settings.

The error message does completly misslead. I would have never come to the idea to check in each and every repository access keys. I wasnt even aware that i ever added a key individually.

With your investigation and pin-pointing to the root-cause, i was able to solve it. Thx

Note: The Account settings -\> Add SSH key -\> Error message regarding 30days, should be correct to reflect the actual reason of the problem.


author: Theodora Boudale
body: Hi Jes,

That's good to hear, I'm glad that the issue is resolved!

I will raise a request to improve the error message we show in these cases.

Please feel free to reach out if you ever need anything else.

Kind regards,  
Theodora


Tags: bitbucket-cloud

ssh