Install The Public Key On Your Bitbucket Account

  1. Open a browser and log into Bitbucket.
  2. Choose avatar > Manage 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. In your terminal window, cat the contents of the public key file.
    For example:
    cat ~/.ssh/id_rsa.pub
                    
    
  5. Select and copy the key output in the clipboard.
    If you have problems with copy and paste, you can open the file directly with Notepad. Select the contents of the file (just avoid selecting the end-of-file character).
  6. Back in your browser, enter a Label for your new key, for example, Default public key.
  7. Paste the copied public key into the SSH Key field.
  8. Click the Add key button:

  1. The system adds the key to your account.
  2. Return to the terminal window and verify your configuration by entering the following command.
    ssh -T git@bitbucket.org
                    
    

    The command message tells you which Bitbucket account can log in with that key.

    conq: logged in as tutorials.
    You can use git or hg to connect to Bitbucket. Shell access is disabled.
                            
    
  3. Verify that the command returns your account name.
    If you got a permission denied (publickey) message. The command tests your connection to Bitbucket as a Git user. It first sees if your SSH Agent has an identity loaded. The command then checks if that private key matches a public key for an existing Bitbucket account. You might have either problem.
  4. To make sure your identity is loaded, enter the following command:
    ssh-add -l
                            
    

    If the identity isn't loaded, check your work in Step 5 above. If it is loaded, try reinstalling your public key on your Bitbucket account.