Step 1: First, create the SSH keys by using the following command:
$ ssh-keygen -t rsa -C "[email protected]"
It will create both id_rsa and id_rsa.pub files for you
Step 2: Now add the id_rsa to ssh list on local computer using the following command:
$ ssh-add ~/.ssh/id_rsa.
Step 3: After generating the keys get the pubkey using:
$ cat ~/.ssh/id_rsa.pub
You will get something like :
ssh-rsa AAAB3NzaC1yc2EAAAADAQABAAACAQCvMzmFEUPvaA1AFEBH6zGIF3N6pVE2SJv9V1MHgEwk4C7xovdk7Lr4LDoqEcqxgeJftwWQWWVrWWf7q9qCdHTAanH2Q5vx5nZjLB+B7saksehVOPWDR/MOSpVcr5bwIjf8dc8u5S8h24uBlguGkX+4lFJ+zwhiuwJlhykMvs5py1gD2hy+hvOs1Y17JPWhVVesGV3tlmtbfVolEiv9KShgkk3Hq56fyl+QmPzX1jya4TIC3k55FTzwRWBd+IpblbrGlrIBS6hvpHQpgUs47nSHLEHTn0Xmn6Q== [email protected]
Step 4: Now all you need to do is copy this key (value) and go to github.com and under the setting (ssh and pgp key) add your public key.
For more information regarding git commands please go through the following link:
If you want to read more about it, you should read Git Tutorial and you can also enroll in Git and Git Hub Training to learn about it in detail.