Skip to content

Instantly share code, notes, and snippets.

@mavuriel
Last active June 12, 2022 02:50
Show Gist options
  • Save mavuriel/5379dddee212314da9bda7f4c6d91c7a to your computer and use it in GitHub Desktop.
Save mavuriel/5379dddee212314da9bda7f4c6d91c7a to your computer and use it in GitHub Desktop.
Process to configure SSH github connection in windows

Guide to generate a SSH Key in Windows

Verify SSH installed

Configuration -> Apps -> Features and apps -> optional features

Use search bar and type "ssh", if it's installed you'll see a result with the name "OpenSSH client"

Terminal

  • Open a terminal (cmd or powershell)
  • Type (or copy) the following command to generate a SSH key
ssh-keygen -t rsa -b 4096 -C "[email protected]"
  • After use that command, terminal will ask you for the folder where to save and password for the key (recommend)
  • When finished terminal will show you where is save your key information, you'll see something like this
Your identification has been saved in C:\Users\your.user/.ssh/id_rsa.
Your public key has been saved in C:\Users\your.user/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:sajdbgeiowuifDFQDWGQW15444venibueuiof [email protected]
The key's randomart image is:
+---[RSA 4096]----+
|                 |
|                 |
|          o      |
|       o         |
|      +          |
|     o           |
|      .          |
|       .         |
|                .|
+----[SHA256]-----+
  • Then you need start the ssh agent with this command:
ssh-agent -s
  • And need to add your key with this command, if you dont changed you need to put the path where your identification was saved:
ssh-add C:\Users\your.user\.ssh\id_rsa

Problems

If you can't initialize the ssh agent you need to do a simple configuration

  • Open Services from the start Menu
  • Scroll down to OpenSSH Authentication Agent > right click > properties
  • Change the Startup type from Disabled to any of the other 3 options. I have mine set to Automatic (Delayed Start)

After that you can reboot your computer (not mandatory), now you can use the command for the SSH agent.

Link for the reference

  • Finally you need to copy your key with this command (only works on cmd):
copy < C:\Users\your.user\.ssh\id_rsa.pub
  • if you wanna use powershell you need to use this command:
cat C:\Users\your.user\.ssh\id_rsa.pub | clip

link to powershell clip reference

Add ssh key on your github account

Finally when you have your key copy on your clipboard, you need to follow these steps:

  • Go to github
  • Sign in and go to your settings sections (click on your profile icon)
  • In your left section options search for "SSH and GPG keys" option
  • In the "SSH keys" section click "New SSH key" button on your right
  • Fill a title input with the name you preffered
  • Paste your key in the key textarea
  • Press "Add SSH key" button and happy birthday!! :D

That's all you need to do for use SSH keys on github with windows , now when you need to add or clone a repository you need to use the SSH option and when you wanna do a commit you need to use your password key (if you have one so keep it secure ;D) .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment