How do you generate an SSH key, add it to Github, and configure it in Ubuntu?

S.M.ABTAHI NOORS.M.ABTAHI NOOR
2 min read

SSH (Secure Shell) is used to manage networks, operating systems, and configurations. It is also inside many file transfer tools and configuration management tools. Every major corporation uses it, in every data center.

Today we are gonna learn how to clone the GitHub repository or push your code to that repository through the SSH key. First of all, we need to generate a new SSH key with the following command :

ssh-keygen -t rsa -b 4096

Yoo! it's created but now you need to check where it is located. So, Go to Home Folder and then find .ssh the folder. Click Enter. ( By the way, If you can't find this .ssh folder in the Home Folder, you must have to check Show Hidden Files or Press Ctrl+H )

Here, you will see some files like this screenshot. Open id_rsa.pub with a text editor and you will see some long text ( key). Here is an example how the key looks like :

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC3H/QMkHQooT7JFFNMT3EwY
A5Ab2VnHMJwaF4eWU29C838+vEYJqHR/6ZhPoeWC3yzAW7SvN6uMjfC6X45I
LcRz7f1t2vYdw9eF+oR4Oz50WUnmzBJlqJMQ14MMcjcZAqHdghYWsBUn
iqKEpXbsAXhq+/zPrRDL+LeN+F/bV3IgeMnBbm/OkqOPTqDwaZz/tw4
Yv5U01z5rqeqYfBRO8Mxu2vFhb5c61HFPx7QJ5uHne6qaHmGrmf9K
b327XaSidXQe/UwL0fYdTygyxhUEciIcfRWdM1hVoQRPDM0JIQD0U
iR0obcc3rxZYtKu0l6aw== dem@demi

Don't copy this key by the way. You have to copy your key that you will find in your id_rsa.pub file. Then just copy (Ctrl+C) whole the thing. Now, we have to add it to our own Github Account. Let's login to our GitHub account. Then ,

Settings> SSH and GPG Keys > New SSH Key > Paste your copied key there> Add SSH Key

Here is the visualization for adding SSH key to your GitHub account -

Congratulations! Let's go... It has been done. Now you can clone any repository, push your code to your repository, etc. Try it out right now!

Thank you so much for reading this! Happy Coding!

If you have any doubt, email me here- abtahi.educxy@gmail.com or text me on linkedin - smabtahinoor

2
Subscribe to my newsletter

Read articles from S.M.ABTAHI NOOR directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

S.M.ABTAHI NOOR
S.M.ABTAHI NOOR