We have a application account in my server for which we have generated a ssh-key. We need to upload the application account public key to all the repositories in my bit-bucket project. There are so many repositories in my project we can't upload the keys manually in every repository every time we generate a new key. So Do we have any automated way to do this?
One ssh-key to all repositories in bitbucket
7.5k views Asked by suru1432002 AtThere are 6 answers
If I understood your question properly. I will explain a few things about BitBucket SSH Access, After that hopefully, you will get your answer.
If you go to your main BitBucket setting, You will see SSH Keys
option under the Security
.
Here you will able to add your SSH Public Key. In my cases I already have a RAS SSH Public key called id_ras.pub
After adding this key I can access all of my BitBucket repositories using SSH from my PC whatever it's new or old repo. You are also able to add multiple SSH Key to your BitBucket account.
They have another option to get read-only access called Use access keys.
In this section, You are able to add SSH Public key per-repository basis.
After adding User Access Keys
the key owner can access this specific repo using SSH. But They will have Read Only
access only. You can use your same User Access Keys
in multiple repositories. So, they will have multiple repo access using the key.
Be sure the key can't be the same key as your Main BitBucket Settings Keys
You need to use another public key as your User Access Keys
In my cases, I don't have any user access keys.
You can know more about Main Account SSH Keys
& User Access Key
using their help link.
March 2022
Looks like BitBucket user interface changed again.
Now SSH keys are configured at https://bitbucket.org/account/settings/ssh-keys/
If you use BitBucket server with a team, then it's likely your team has gotten a "projectKey", i.e. a namespace where you can add multiple Git repositories. The projectKey's value is usually the part shown in UPPERCASE in the URL.
You can configure the public SSH key for your application under "Access Keys" on each Repository's Settings, but rather use the Project Settings. These apply to all repositories under the project.
You can update ssh keys with the REST API:
/rest/keys/1.0//projects/{projectKey}/ssh
Not sure if this is what you need, but you can create a "project" and move all the repos to that project, then use the following interface to create a project-level SSH key which should work for all existing and new repos.
https://bitbucket.org/<organization>/workspace/projects/<project_key>/settings/access-keys
I think op is asking about where to add a ssh-key that allows access to all repositories (for automated clones in pipeline etc). To best of my knowledge you do this within your workspace
https://bitbucket.org/YOURWORKSPACE/settings/ssh-keys. if you have already added that key to any of your repos under access keys it will fail though so best to make a new key, or go through all your projects and remove it then add it here
I am not sure, I understand your question correctly. In Bitbucket setting(under your profile) > "SSH keys" you can add your ssh-key for account and it should work for your all repositories.