Skip to content

Instantly share code, notes, and snippets.

Created February 23, 2021 13:31
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
GitHub SSH Windows 10 WSL2

Add SSH to GitHub

Why another tutorial about SSH on Windows 10 for GitHub ?!

Because EVEN official documentation is messy (At least for me)

So I make a cheatsheet for myself and share it for you

I don't write to much info, You know what are these already

So get back to work :happy:


  • Windows 10 (Obviously)

    I have 20H2

  • SSH

    SSH Agent comes with Windows by default (Named OpenSSH Authentication Agent)

  • Terminal

    (I recommend Windows Terminal)

  • Internet connection (Again Obviously)

  • WSL2 Installed and functional

Existing SSH

First we check Windows drive not WSL2

Windows Drive C



WSL2 SSH folder is not same as Windows Drive C SSH folder

Directory contain

  • id_rsa


  • id_ed25519

If you have these copy this file to WSL2 SSH folder in ~/.ssh

WSL2 Location


Generate SSH Keys

Don't talk just do commands


ssh-keygen -t rsa -b 4096 -C "Your EMAIL"


ssh-keygen -t ed25519 -C "Your EMAIL"

This will generate those file I mentioned earlier above

If you run this command in powershell then they are in Drive C

If not, then you probably run them in WSL2 so they are ~/.ssh

Just copy them over

Be sure they are same files in both drive

Permission in WSL2

chmod 600 ~/.ssh/id_ed25519

Add to SSH Agent

ssh-add ~/.ssh/id_ed25519


ssh-keygen -t ed25519 -C "Your EMAIL"

ssh-keygen -t rsa -b 4096 -C "Your EMAIL"

chmod 600 ~/.ssh/id_ed25519

chmod 600 ~/.ssh/id_rsa

sudo apt install keychain

eval keychain --eval --agents ssh ~/.ssh/id_ed25519

eval keychain --eval --agents ssh ~/.ssh/id_rsa

stat -c "%a %n" id_ed25519

stat -c "%a %n" id_rsa

ssh -vT

eval $(ssh-agent -s)

ssh-add ~/.ssh/id_ed25519

ssh-add ~/.ssh/id_ed25519

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