Authenticate github using ssh

SSH is a tool by which we can create a secure connection between the client and server. Basically it is an asymmetric type encryption that creates two key one is public and one is private. Public key can be distributed publicly and it is used for encrypt the data and the private key have to be kept secret for decrypting the data. Below commands will create the ssh keys:

$ ssh-keygen -t rsa -C "your_email@example.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ani/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/ani/.ssh/id_rsa.
Your public key has been saved in /home/ani/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Up6KjbnEV4Hgfo75YM393QdQsK3Z0aTNBz0DoirrW+c ylo@klar
The key's randomart image is:
+---[RSA 2048]----+
|    .      ..oo..|
|   . . .  . .o.X.|
|    . . o.  ..+ B|
|   .   o.o  .+ ..|
|    ..o.S   o..  |
|   . %o=      .  |
|    @.B...     . |
|   o.=. o. . .  .|
|    .oo  E. . .. |
+----[SHA256]-----+

Now you have created a pair of keys and you have to add the public key in the github. Follow below instructions after doing the above the task –

  1. Go to your github page and open settings.
  2. Now click the SSH and GPG keys.
  3. Now click New SSH key.
  4. In the title field add a relevant title fr your key. Like if you are using Linux on your PC the give a title like “Linux PC”.
  5. Then paste your public key in the box.
  6. Then click Add SSH key.
  7. If it ask for your password then confirm your password.

Thank you 🙂