Sunday, 8 January 2023

Authenticate GitHub Using SSH - Step By Step

There are multiple algorithms available to generate the SSH("Secure Shell") keys

  1. ssh-keygen -t rsa -b 4096
    1. Old algorithm not recommended to use.
  2. ssh-keygen -t dsa
    1. Old US government Digital Signature Algorithm.
  3. ssh-keygen -t ecdsa -b 521
    1. New Digital Signature Algorithm standardized by the US government
  4. ssh-keygen -t ed25519
    1. New algorithm added in OpenSSH.
    2. Recommended by github.com
in the above commands 
    -t means type
    -b means no of bits
    -rsa, dsa, ecdsa, ed25519 are algorithms

Step 1:

cd ~/.ssh

Step 2:

ssh-keygen -t ed25519 -C "youremail@domain.com"


Step 3:

eval "$(ssh-agent -s)"  or eval `ssh-agent`

Step 4:

ssh-add dshyam2109  (<- your key name)

Step 5

cat dshyam2109.pub


Step 6:

Copy your public key from above step and paste it in the GitHub -> Settings as shown in below screenshot.



Now you can successfully access your repositories using SSH key.

You can find more information here 
  1. SSH
  2. GitHub
Alternate ways:
  1. Windows credential manager to store GitHub username & password.
  2. Install GitHub desktop (Recommended easy to use for beginners)

Authenticate GitHub Using SSH - Step By Step

There are multiple algorithms available to generate the SSH( "Secure Shell" ) keys ssh-keygen -t rsa -b 4096 Old algorithm not rec...