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.

How to Configure SSH Key for GitHub on Ubuntu


  • 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
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 key on GitHub

mkdir .ssh
cd .ssh
ssh-keygen -t rsa -b 4096
ssh keys for GitHub

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/

Copy the content, paste it in the GitHub Form and press the “Add SSH Key” button

This is totally fake

Finally, we need to check that our SSH is working or not by entering the following command

ssh -T

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:)




DevOps Engineer - Author

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

GSoC Week 6# Blog

Samsung Galaxy S22 full specifications, price and best deals

Samsung Galaxy S22 full specifications, price and best deals

Solid: Go with the flow

UX Work: Woman's hands drawing a wireframe

Live Holdem Pro

Live holdem pro for windows

Getting started with IoT and Data Visualization using IBM Cloud

Appium : Different locator IDs for the same element in different phones? Read on…

My journey to choose a high end 3D printer (Raise3D E2) — Part 2

Build Backend Apps At Super Speed with Python FastAPI

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adil Shehzad

Adil Shehzad

DevOps Engineer - Author

More from Medium

Serve HTML page through Apache

Installing NGINX Web Server on Ubuntu 18.04 LTS

How to backup and clone your Jenkins Instance

Ansible troubleshooting — This command has to be run under the root user