Use access keys

You can use access keys with your Bitbucket Cloud repositories. An access key grants read-only access to a public or private repository. With an access key, a user or a process can pull or clone a repository over SSH. Access keys have the following features and limitations:

  • Access keys do not apply to your plan limit. 
  • You can add the same access key to multiple repositories.
  • The access key must be unique — it cannot also be associated with an account.

Access keys are useful for authenticating a build server to checkout and test your code.   

Before you begin

Make sure you have already generated your access key. For detailed information on the SSH protocol and generating keys, see Use the SSH protocol with Bitbucket Cloud.

How to add an access key

If you are using the access key for building code, make sure your build server has the key installed. For example, if you are using Bamboo, each agent should have the key installed. To add an access key to a Bitbucket repo, do the following:

  1. From the repository, click Settings in the sidebar.
  2. Click Access keys from the left hand menu.
  3. Press Add key.
  4. In the 'Add SSH key' dialog, enter a label and add the public key.

    In Linux you can use cat to copy the contents of the public key:

    $ cat ~/.ssh/

    In Mac OS X, the following command copies the public key to the clipboard:

    $ pbcopy < ~/.ssh/
  5. Press Add key.

    Bitbucket notifies you by email that a key was added to your account.

If you are using your key for a build system, it is a good idea to confirm the key is working correctly from the build server (or Bamboo agent). For example, you could manually clone a repository on the server using the SSH protocol and the key. If you have trouble using your key, see Troubleshoot SSH Issues.

Edit a access key

After you add a key, you can edit the key's Label but not the key itself. If you need to change the key's contents, you must delete and re-add the key.  This is a security measure. In the event your account security was hacked without your knowledge, the hacker could not replace or damage your existing keys.

Did you like this page? Give feedback!

Have a question about this article?

Ask our community
Powered by Confluence and Scroll Viewport