Add an SSH key to an account

This page covers the following topics:

How to add a key using SSH for OS X or Linux

  1. From Bitbucket Cloud, choose avatar > Bitbucket settings from the application menu. 
    The system displays the Account settings page.
  2. Click SSH keys.
    The SSH Keys page displays. If you have any existing keys, those appear on this page.
  3. Back in your terminal window, copy the contents of your public key file.
    For example, in Linux you can cat the contents.

    $ cat ~/.ssh/id_rsa.pub

    In Mac OSX, the following command copies the output to the clipboard:

    $ pbcopy < ~/.ssh/id_rsa.pub
  4. Back in your browser, enter a Label for your new key, for example, Default public key.

  5. Paste the copied public key into the SSH Key field:
  6. Press Add key.
    The system adds the key to your account. Bitbucket sends you an email to confirm addition of the key. 

How to add a key generated by PuTTY

  1. Open a browser and log in to Bitbucket.
  2. Choose avatar > Account from the menu bar.
    The system displays the Account settings page.
  3. Click SSH keys.
    The SSH Keys page displays. It shows a list of any existing keys. Then, below that, a dialog for labeling and entering a new key.
  4. Switch to your local desktop and start the PuTTYgen program.
  5. Press Load.
  6. Navigate to and open your default private key.
  7. Enter your passphrase when prompted and press OK.
    The system displays your public key.
  8. Select and copy the contents of the Public key for pasting into OpenSSH authorized_keys file field.
  9. Back in your browser, enter a Label for your new key, for example, Default public key.
  10. Paste the copied public key into the SSH Key field:
  11. Press Add key.
    The system adds the key and it appears in the SSH Keys listing.
  12. Close PuTTYgen.

Testing which key you are sending

You can test which user account your agent presents to Bitbucket using the ssh-add command:

$ ssh -T git@bitbucket.org
conq: logged in as atlassian_tutorial.

Editing an SSH 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.

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport