Last updated July 14, 2015.
This is a simple method to create, upload and verify an SSH Key with Drupal.org
Generate a key for the first time
Open the Git Bash window and change to the .ssh directory
If the .ssh directory does not exist, change to the user directory then create the .ssh directory and enter it.
NOTE: Do not include any spaces in your keyname as it can cause problem when you upload your public key to some sites.
At the Git Bash prompt, enter:
ssh-keygen -t rsa (optional " -C keyname" where keyname is anything you want)
You should see:
Generating public/private rsa key pair.
Enter file in which to save the key (/u/.ssh/id_rsa):
Press 'Enter' here to accept the default
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Press enter to leave the passphrase empty.
Your identification has been saved in /u/.ssh/id_rsa.
Your public key has been saved in /u/.ssh/id_rsa.pub.
The key fingerprint is:
Copy your Key
At the Git Bash prompt, type:
You should see something like:
OBaagayPGPItqx8cuebGiCdR7an5o6XYefcWgeNxa8gYNjOUWs3TSw7if6o4GnG/4Jwk/f8abaG9BYv/OpLlpeV rgkKWhVL56yWgd8Pbry3y6yM/S3T3lfYYdfbzo8JecHFnFrhCdYXbftg2qcvfRq/iXaoHQlJzUkr5zpu1pyD7Pd M/1H6YlBlP18Ge+lAfgLZd9x8nxMNAq+0zrozitIRC/kR5LE7HbJWBrFhFZQqFpVSSXwIZDpou6Js7c5GP2S/0 O+z2FvrbjvP9g4/mrRv48a3R/0tc4U0GWlAFMp6W/CZjaYQe74/3Y2rGvYLyh762AqVagWOnnmw== keyname
Even though you can see it, right there, you can't copy and paste it unless you've changed some Windows system settings. Instead, open the id_rsa.pub file with a text editor like Notepad. It's located at /u/.ssh/ in our example. The path on your machine is visible in Git Bash after the "Enter file in which to save the key".
Put your key on Drupal.org
- Log in to Drupal.org.
- Click "Your Dashboard" » Profile » SSH Keys » Add a public key
- Paste your key into the text area. Anything after the == will become the title of your key, so if you've been following along, you can leave the title blank. It's purely for your convenience, so you can also name it anything you want, perhaps the name of the computer the key associates with (my laptop).
Test your key
To test your key, clone an actual project from Drupal.org. You can use the example below or locate the clone command for a project you actually need.
NOTE: The below code attempts to log you into git.drupal.org. However, you can not login until you have created your git username and agreed to the Drupal version control system rules. To do this, login into your account on drupal.org, select Your Dashboard tab, select the Profile tab, select Edit, select Git Access. On the Git Access page, you will need to agree to the Drupal version control rules and follow the rest of the instructions on this page. Once you have completed all of the drupal.org steps, you can proceed with the below code.
Also you will need to change the text "username" to the user name you created on the Drupal.org Git Access page.
git clone firstname.lastname@example.org:project/examples.git
You should see:
Initialized empty Git repository in /home/melissa/examples/.git/
The authenticity of host 'git.drupal.org (188.8.131.52)' can't be established.
RSA key fingerprint is 16:f5:44:6c:a1:c6:be:72:cd:98:b5:b7:7d:26:d6:14.
Are you sure you want to continue connecting (yes/no)?
Type 'yes' at the prompt and press 'Enter'.
Next you'll see something like:
Warning: Permanently added 'git.drupal.org,184.108.40.206' (RSA) to the list of known hosts.
remote: Counting objects: 1737, done.
remote: Compressing objects: 100% (619/619), done.
remote: Total 1737 (delta 1176), reused 1667 (delta 1106)
Receiving objects: 100% (1737/1737), 525.92 KiB | 846 KiB/s, done.
Resolving deltas: 100% (1176/1176), done.
If you are not asked for a password, you have successfully set up a new SSH key.
If you're just testing, then finish by removing the clone directory you just downloaded:
rm -rf examples
That's it! You are done.