SSH user keys for personal use
- Bitbucket Server supports DSA and RSA2 key types – RSA1 is not supported.
- A Bitbucket Server user can add any number of keys to their account.
- You can use the same SSH access key for multiple repositories or projects.
- Keys used for personal user accounts can't be re-used as a project or repository access key, and keys used as a project or repository access key can't be re-used for user accounts.
Add an SSH key to your Bitbucket Server account
On Windows, in your command prompt, change directory to your .ssh directory, and copy the public key file to your clipboard by running:Windows
cd %userprofile%/.ssh clip < id_rsa.pub
On macOS or Linux simply run the following in a terminal:Mac OS X
pbcopy < ~/.ssh/id_rsa.pub
Note that on Linux, you may need to download and install xclip, then use that, as shown in this code snippet:Linux
sudo apt-get install xclip xclip -sel clip < ~/.ssh/id_rsa.pub
In Bitbucket Server, go to your account:
- Select View profile.
- Click on SSH keys and then Add key.
- Paste the key into the text box:
- Click Add key. You're done!
Use SSH keys to connect to Bitbucket Server repositories
SSH access needs to have been set up, as described above. Once this is done, you can use SSH keys as follows:
- Go to Projects, click a project, and choose a repository from the list.
- Click Clone in the sidebar to see the clone URLs for the repository.
- Choose the clone URL you want to use. SSH is available if you have already added an SSH key to your account. If you haven't done that yet, see Add an SSH key to your Bitbucket Server account, above.