Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

How to generate & upload your public key to github for SSH access on github

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

Step 4 – Copy a id_rsa.pub into SSH keys

Step 4 – Clone git repo using ssh and it should work.

Rajesh Kumar
Follow me
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x