Generating SSH key

Example will use OS Windows, but commands and order of actions for Linux and Mac will be the same.

Open the console (terminal) and enter the command:

ssh-keygen -t rsa -b 4096 -C "yourEmail@example.com"

where yourEmail@example.com - your email address. This command creates a new SSH key, using e-mail as a label.

ssh-keygen -t rsa -b 4096 -C 'yourEmail@example.com'

Next you will be prompted to "Enter a file in which to save the key", press Enter (the default save location of the file):

Enter a file in which to save the key (/d/openserver/.ssh/id_rsa): [Press enter]

SSH key, enter a file in which to save the key

Then enter the password (passphrase) and repeat it:

Enter passphrase (empty for no passphrase): [Enter your password and press enter]
Enter same passphrase again: [Repeat your password and press enter]

Well done, key is ready to use

SSH key is ready to use

Now we have 2 files id_rsa and id_rsa.pub which are on the way (in the case of the example) D:/OpenServer/.ssh. File with extension .pub this is your public key, and second file is your private key.

Adding SSH key to github

The key is ready to use, it is now necessary to add it to the site github.com. Open https://github.com/ and sing in. After that, go to the Settings (https://github.com/settings/profile) => SSH (https://github.com/settings/ssh) and click on "Add SSH key"

github home page

github, add SSH key

Enter a label for the key and the key. The key is the content of the file id_rsa.pub (D:/openserver/.ssh/id_rsa.pub), click the button "Add key":

github, save SSH key

Done. Key added to github.

Adding SSH key to bitbucket

Open bitbucket.org and sing in. After that, go to Bitbucket settings (https://bitbucket.org/account/user/userName/) => SECURITY => SSH keys (https://bitbucket.org/account/user/userName/ssh-keys/) and click "Add key":

bitbucket, home page

bitbucket, add SSH key

Enter a label for the key and the key. The key is the content of the file id_rsa.pub (D:/openserver/.ssh/id_rsa.pub), click the button "Add key":

bitbucket, save SSH key

Done. Key added to bitbucket.

Adding repository using the SSH key to SmartGit

Open SmartGit. And add the repository (Repository => Add or create...) Ctrl + O:

SmartGit, add repository

Insert the path to the folder where will be stored code:

SmartGit, add existing or create new repository

Confirm repository initialization:

SmartGit, confirm repository initialization

Press the button "Pull" or Ctrl + P. We were given a message that the repository can not be found and will offer to add it, click on "Add Remote":

SmartGit, pull

Paste the url where we clone the repository and click "Add":

SmartGit, add SSH url

As we have pointed out is not https url, we need to specify the path to the file with the private key (D:/OpenServer/.ssh/id_rsa) and the password (passphrase) to it (that we specified when creating this key pair):

SmartGit, add private key

Done. Key added. Continue to work with the repository as usual. When referring to any of the user's public repository this key will work again, adding it is not necessary.