DEV Community

Cover image for Connecting Secure Socket Shell (ssh)🀫 to GitHub
Francis
Francis

Posted on

Connecting Secure Socket Shell (ssh)🀫 to GitHub

SSH protocol gives users/system administrators secure access over an unsecure network to a computer.

It is commonly used to secure remote access to resources, remote execution of command, delivery of software packages and updates and interactive and automated file transfers. None of this would be possible if it weren't for the back and forth between the SSH Client and the SSH Server.

First the server sends its public key to the client, and the key is saved on the client. If I tell you that is where the magic happens then they establish a connection, would that be okay for you? Because it is for me.

This does not have to be right, but I imagined it is the Force and the private key must be the midichlorians, you might not want to admit or know it is responsible for all the access and power you currently have, but it is there doing its work in the background.

GitHub is where developers go to count little green boxes//be antisocial and social…. or a code hosting platform for version control and collaboration possibly.

Why GitHub and SSH?
Tired of always entering a password authentication for pushing and pulling to remote repositories? SSH keys got you covered, minus or plus a passphrase if you choose to make one during the set up phase, I traded a password for a passphrase yay me.

Step 1
If you do not already have Git Bash for windows, now is the time to download it. Plus GitHub, I have a feeling you can not get this done without a GitHub account.

Step 2
Enter this in the command line

$ ssh-keygen -o
Enter fullscreen mode Exit fullscreen mode
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/PCName/.ssh/id_rsa):
# Sets it to default location 
Enter fullscreen mode Exit fullscreen mode
Enter passphrase (empty for no passphrase): [Type passphrase]
Enter same passphrase again: [Type passphrase again]
Enter fullscreen mode Exit fullscreen mode
Your identification has been saved in /c/Users/PCName/.ssh/id_rsa
Your public key has been saved in /c/Users/PCName/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:############################################### PCName@PCName-######
The key's randomart image is:
+---[RSA ####]----+
|         Someth  |
|          ings ar|
|         e just r|
|         ally coo|
|        l when y |
|         ou think|
|         about ho|
|         w it act|
|            ually|
+----[workss]-----+
Enter fullscreen mode Exit fullscreen mode

Do not tell anyone, but now you have a public and private key 🀫.
Located in /c/Users/PCName/.ssh/id_rsa

Step 3

$ cat ~/.ssh/id_rsa.pub
**************** A key is generated here *************** 
#Copy it and go to github
Enter fullscreen mode Exit fullscreen mode

Step 4
Github--> Settings--> SSH & GPR key

1
2
3
4

To use the ssh key just go to a git repository and select Code, Under Code select SSH and copy to clipboard.

Back to Bash again.

$ git clone [paste ssh link key from github]
Enter passphrase: [enter]
Enter fullscreen mode Exit fullscreen mode

Hope this helps you get work done faster.

Top comments (0)