How to Configure SSH Key for GitHub on Ubuntu
As we previously learned how to Run the Ubuntu machine on Windows 10 using VsCode Extension WSL. Incased you missed it please learn from this blog.
Prerequisites:
- Ubuntu Machine
- Git
- Linux basic Commands
Git Installation or Version check
As Git is pre-installed in git you can check by entering the following command
git --version
In case if git is not installed in your Linux system you can install by using the following commands
sudo apt-get update
sudo apt-get install git
and after these following commands you can check your git installation by the first command we execute in this blog
git --version
Creating Private and Public SSH Keys
First, we need to create private and public keys. Please do not share your private key on any platform. Please only share the id_rsa.pub key on GitHub
mkdir .ssh
cd .ssh
ssh-keygen -t rsa -b 4096
so the ssh keys are generated inside your /home/adil/.ssh/id_rsa (please change adil username to your username you are using)
Now, you have to add the public SSH Key into your SSH Agent:
sudo ssh-add /home/<your username>/.ssh/id_rsa
Sometimes, depending on your Linux configuration, you could have the message “Could not open a connection to your authentication agent.”. In that case, you should execute:
eval `ssh-agent -s`
Configure SSH Key for GitHub on Ubuntu
first, you need to go to your GitHub account and then go to settings on the left side 11 rows you will found SSH and GPG Keys Click on it
Profile Pic/Settings/SSH and GPG Keys
Then Press on the New Key
Go back to the terminal and enter the following command. You need to copy the following command and please do not share with any person or platform.
cat ~/.ssh/id_rsa.pub
Copy the content, paste it in the GitHub Form and press the “Add SSH Key” button
Finally, we need to check that our SSH is working or not by entering the following command
ssh -T git@github.com
Hurrah Finally we configure our SSH on Github and Ubuntu Machine.
If you are facing any kind of problem feel free to reach out on Linkedin.
That’s All! See you in the next blog. Cheers:)