Generate SSH key in Ubuntu:
mkdir ~/.ssh #Create a new directory called chmod 700 ~/.ssh #set the rights for ssh folder ssh-keygen -t rsa #generate a private rsa key pair
Which results in the following, where you will be prompted first to enter a name for the key and then twice to enter the same passphrase. The name wil be the name in the current folder for which the key will be generated:
Generating public/private rsa key pair. Enter file in which to save the key (/home/b/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/b/.ssh/id_rsa. Your public key has been saved in /home/b/.ssh/id_rsa.pub.
Load identity into SSH manager
Add SSH key to BitBucket:
Print the SSH key and copy it from the terminal:
Got the BitBucket Settings page in your BitBucket account.
Navigate to Security; SSH Keys; Add Key
Fill in a name and paste the SSH code.
Make sure the Key is added correctly:
Now you should be able to clone your private repositories with:
hg clone ssh://email@example.com/me/my_repository