Adding SSH Key in BitBucket repository in 2 minutes

SSH Key iin GIT
SSH Key in BitBucket

Step 1

go to the SSH folder:

cd ~/.ssh/

Step 2

Generate the SSH Key

ssh-keygen

Just click enter when prompted for:

Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again:

You should now see:

Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
0d:..
The key's randomart image is:
+--[ RSA 2048]----+
..
+-----------------+

Step 3

Get the SSH key

 cat ~/.ssh/id_rsa.pub

You should see the SSH key that will look something like this:

ssh-rsa AAAAB3NzaC1yc2EAAdddAABAQDIyDCTxu0o9bjYXTcW8W3H3XqfCiMJLvdyIGJtMmuhyfCKFaOHDhgfZEvswiV6oDLRKW3ay586Ioa0fvoItrXaqng/GqyflK1A4Ru+WUbcFAncCUGE69pBRPvnYEpiA5AB5ra2r1lm6bfsvF4f4u7b/Y4CCpZYxhmBEDtyKAErxrfdudWaqUWs5A1RPxE38KrA2kIcsixiJ0kJt+VM9bK5jz+zb2nt/p4lBbVAdMlCjYZ54CrQC4/nTspWUNQ195T1 root@staging.yourdomain.com

Copy this key

Step 4

Now go to your BitBucket page and go to your user > BitBucketĀ settings

Go to SSH Keys under Security

And add your key

Step 5

Now the SSH Keys have been established go back to the staging server and change the remote location to the SSH located listed on BitBucket.

Click here to learn how to identify what your GIT Remote Repository is.