Someone has already added that key as an access key to a repository
Asked by Ivan Kol:

Hi,

I don't know what repository uses my key

Could you tell me, so I can remove it?

Thanks


Answers:
author: Nic Brough -Adaptavist-
body: Welcome to the Atlassian Community!

There's no easy way to work this out because the keys that belong to other accounts should not be shared.

If you shared the key with someone, you should know who. If you were given the key by someone, then you'll need to ask them.

If you have no luck chasing it down, you can raise a support request with Atlassian, and they can search out the key for you and hence identify the account you shared it with.

If you don't want to spend ages chasing down the share, then you can (and should) create a new key for your account and use that instead.

comments: author: Ivan Kol
body: Hi,

the key is not shared and used only by me. I'm trying to use it globally for all my repositories and this message pops up.

I think it's been set to mine repo, because I followed your guide to setup ssh git access and it worked. Now I want to delete it and use it in my profile but I can't find it anywhere though.

Creating another pair should be my last resort.


author: Ivan Kol
body: BTW: what exactly is the problem if the key is used in more than one repo?


author: Rob van der Lee
body: I suppose it helps you work more structured. Bitbucket only allows a key to be added once. Once added, you won't be able to add it to another account/repository. This is a common good practice. I'm not sure what you are trying to do but let me try.

A way to gain access is to add the user holding that particular key to the desired group/repository.

Another way is to generate a new key for the account/repository. You have not provided any

Let me ask some questions to get some more information on what you are trying to do:

1. Is the repository you are trying to access held under your account?
2. Are there multiple accounts?

--

**To add SSH keys on account level visit:**   
<https://bitbucket.org/account/settings/ssh-keys/>


author: Ivan Kol
body: Some additional info:

* Is the repository you are trying to access held under your account?

Yes, it is

* Are there multiple accounts?

No

**To add SSH keys on account level visit:**   
<https://bitbucket.org/account/settings/ssh-keys/> - trying to add my key there gives me an error "Someone has already added that key as an access key to a repository" which surprises me...

Looking at Audit log, I think the key was added once at 2022-03-10

using this guide: <https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/>

And command

$ ssh -T git@bitbucket.org

works.

What should I do next to set it on account level?


author: Rob van der Lee
body: You should scan all your repositories. As you can add keys to a particular project. It might be on repository level. If it is not on this account than you should really think hard if it might have been added on another account.

I've had this once where I used one of my own keys on my work account and tried to add that key when I was at home.

If you cannot seem to find it then you still have the option to generate a keypair.


author: Ivan Kol
body: Hmm,

I've found it at last... I don't understand why Bitbucket has so many places to put a key - there should be a central management for all repositories where the admin can see them all.

It's tedious work to walk through all repos for a single key...


author: Rob van der Lee
body: I'm glad you found it! It can be confusing at first. It allows for some more flexibility. Let's say you want to setup some additional tooling that requires SSH. The repo level keys allow for purpose build keys.

Anyway, now you know. Happy coding! :)


Tags: bitbucket-cloud

cloud