Github is a place where people can share the code and can develop project by coordinating contribution from different sources.It is a nice version manager tool.
To add code to the github account safely we need authorization mechanism.By generating ssh key, we can make sure that codes are added only from safer zones(with our prior knowledge).SSH will generate one private key and public key, the public key we have to add in online github account.Let us see how to generate the keys:
To create key, we need ssh to be installed in our system.
1) ssh-keygen -t rsa -C “your-email”
Enter the file path where this has to be saved, by default it will save in “home/username/.ssh” folder.Also enter the pass phrase for the key (optional). Now one private and public key will be generated in the specified folder.
2) ssh-add ~/.ssh/id-rsa
This code will add the recently created ssh key to ssh agent.
3)Now we have to add the public key of the key pair to github account.Open your github account in browser and click on account settings.There we can see “SSH Keys” option.Now select add ssh key option and paste the content of public key (~/.ssh/id-rsa.pub).You can open public key in any editor and copy the contents to paste it in github account.
4) ssh -T firstname.lastname@example.org
Now, its time to check whether it is working properly.This command will try to establish connection with https://github.com through ssh.If you get success message, then its done perfectly.
I am done with my github account .
“Hi ashiksp! You’ve successfully authenticated”
Refer this for detailed information.
Happy Hacking… 🙂