Generate an SSH Key Pair

cd ~/.ssh && ssh-keygen -t rsa

Copy the Public key

cat ~/.ssh/

Copy the output given as a result of the command above. It is the content of your file.

If you are on a Mac, you can directly copy the contents of by running

cat ~/.ssh/ | pbcopy

Start the SSH Agent and Load your keys

See if ssh-agent is running

ps -e | grep [s]sh-agent

If no output is given then it means it is not running. Start the agent by running:

ssh-agent /bin/bash

Load your SSH Key with the ssh-add command

ssh-add ~/.ssh/keyname

List the loaded keys to make sure it has been added.

ssh-add -l

Add it to Bitbucket

Go to Manage Account > Security > SSH Keys > Add Key