Step 1 – First Check if you public and pvt key already generated in your system?
i.e – in USER HOME C:\Users\Rajesh Kumar.ssh, check id_rsa(pvt) and id_rsa.pub(pub)
If id_rsa & id_rsa.pub found, directly move to step 3
Step 2 – Generate id_rsa & id_rsa.pub (exammple done in linux)
---------------- POWERSHELL WINDOWS ------------------------
PS C:\Users\Rajesh Kumar> ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\Rajesh Kumar/.ssh/id_rsa):
---------------- LINUX BASH ------------------------
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:XkUuIn9RzXvZzQ3ihjr5Edyj/h9M3UICWy1mW8YncR8 root@localhost.localdomain
The key's randomart image is:
+---[RSA 2048]----+
| . +=.E.|
| B= X.+|
| . ..+*+*.**|
| o .++*o.oB|
| Soo+ .o.o|
| .+oo o . |
| .+ . o |
| o . |
| .... |
+----[SHA256]-----+
--------------- LINUX & MAC ------------------------
[root@localhost ~]# ls .ssh/
id_rsa id_rsa.pub
--------------- WINDOWS------------------------
PS C:\Users\Rajesh Kumar> ls .\.ssh\
Directory: C:\Users\Rajesh Kumar\.ssh
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 05-03-2022 09:50 old
-a---- 05-03-2022 09:50 2622 id_rsa
-a---- 05-03-2022 09:50 582 id_rsa.pub
-a---- 20-06-2022 19:57 11248 known_hosts
-a---- 20-06-2022 18:42 10588 known_hosts.old
Step 3 – Login to github and go to https://github.com/settings/keys
![](https://www.devopsschool.com/blog/wp-content/uploads/2022/06/image-33.png)
Step 4 – Copy a id_rsa.pub into SSH keys
![](https://www.devopsschool.com/blog/wp-content/uploads/2022/06/image-34-1024x603.png)
Step 4 – Clone git repo using ssh and it should work.
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND