GIT : How to generate SSH key in Windows for GIT

Points to Remember

  1. Download and install Puttygen to generate the SSH key to be used in GIT.
  2. Save the Private Key in a safe location and do not miss it.

STEP 1 : Open Puttygen to generate Key

Puttygen is a opensource plugin of Putty and is used to create Public/Private keys for WinSCP.

When you open the puttygen you will see the following screen as shown in image below

Open Puttygen

Now Select the following

  1. Select SSH-2 RSA (Type of key to generate tabs)
  2. 1024 (Number of bits to use to generate key)
  3. Click Generate button to generate the key.

STEP 2 : Generating Key

After you click the generate button you will see the following screen

Open Puttygen Keep clicking on the empty space provided until progress bar reaches the end This is used to create randomness in the key. Once the progress bar reaches the end, it will show the generated key.

STEP 3 : Save Public & Private Keys

Once your key is generated you will see the public key in the text box at the top as shown in the image below.

Open Puttygen

The screen shows the following things.

  1. Public key at top.
  2. Key fingerprint used to create the key.
  3. Key Phrase. You can add a password to your generated key. If you add password to the key then you have to enter the password/key phrase everytime you do ssh. This is extra security to the key however you can keep it empty, if you are sure nobody can copy the key from your system.

Click on Save private Key & Save public Key to save the keys.

Save the private key in a safe directory or location. If you miss this private key you will not be able to use ssh.

Private key is saved in the .ppk format on windows. Do not change the extension of the file

STEP 4 : Load Private Key to Puttygen

You can load the saved private key in Step 3 to view the public key. You will see the following screen when you click on Load Open Puttygen

Just select the saved private key and you will be able to see the public key.

STEP 5 : Use Public Key

Right click on the public key textbox
Open Puttygen

Click on Select All to select the the public key and then copy the Public Key for the nect step.
Open Puttygen

Step 6 : Adding Public key in GIT for SSH

Open your Github account and go to profile settings, then click on SSH and GPG keys tab.
Open Puttygen

Click on the New SSH Key button as shown in the image below
Open Puttygen

Add the Key title in the title box and public key generated in previous steps in the space with label key and finally save by clicking on Add SSH key button in green.
Open Puttygen

No comments :

Post a Comment