How To Connect Your Windows To GitHub Via SSH

Subhadeep Choudhuri
4 min readJun 18, 2021

--

For beginners to understand, you might need to connect your PC to GitHub to store your project and its versions secured on cloud. You can upload files/folder directly to GitHub using its user interface but their is far easier and quicker and professional way to do the same.

Using SSH ( Secure Socket Shell ) you can directly upload your entire code from your computers command prompt but to do so GitHub must know and acknowledge your computer as a authorized device or else anyone would upload code that might break or corrupt your code on cloud.

Here I will only explain how you will make GitHub acknowledge your system in few Simple Steps:

Also you can find this story on my blog page here watsbrewing.com

1. Generating a new SSH key

a) Open Git Bash ( If not installed you can simply download and install it from here )

b) Paste the text below, substituting in your GitHub email address.

$ ssh-keygen -t ed25519 -C "your_email@example.com"

This creates a new ssh key, using the provided email as a label.

c) When you’re prompted to “Enter a file in which to save the key,” press Enter. This accepts the default file location.

d) When prompted Enter Paraphrase it is like a password you create and must remember. Although if you are not confident enough to remember the password you could just press enter twice that means whenever you will connect you need not enter any password which means less security.

Sample Image
Parts colored white for security purpose

Adding Your SSH key to the SSH Agent

a) Starting the ssh-agent in the background

# start the ssh-agent in the background
$ eval "$(ssh-agent -s)"

b) Adding the ssh private key to the ssh agent

# add the ssh private key to the ssh agent
$ ssh-add ~/.ssh/id_ed25519
Parts marked white for security purpose

Very good, We are half the way now. If you faced any difficulty until now or you had existing ssh keys you can click here for detailed reference and guidance from GitHub official docs.

Adding the new SSH-Key to you GitHub Account

  1. Copy the SSH public key to your clipboard.
$ clip < ~/.ssh/id_ed25519.pub
# Copies the contents of the id_ed25519.pub file to your clipboard

Tip: If clip isn't working, you can locate the hidden .ssh folder, open the file in your favorite text editor, and copy it to your clipboard.

2. Open and login to your GitHub account

Click on the settings tab as highlighted

3. In the user settings sidebar, click SSH and GPG keys.

4. Click New SSH key or Add SSH key.

5. In the “Title” field, add a descriptive label for the new key. For example, if you’re using a personal Laptop, you might call this key “Personal Home Laptop”.

6. Paste your key into the “Key” field.

Testing you Connection

  1. Open GitBash
  2. Enter the following:
$ ssh -T git@github.com
# Attempts to ssh to GitHub

3. Now here I faced an issue:

4. Noticed the RSA key fingerprint was different than to what I added to the GitHub.

5. Solution : When this line prompts : Are you sure you want to continue connecting (yes/no/[fingerprint])?

Rather than writing yes / no , paste the code that you GitHub is displaying

Copy the entire code highlighted

All Done !!

--

--

Subhadeep Choudhuri

As a seasoned software engineer with three years of experience, I specialize in React and boast full-stack development skills and love to solve challenges.