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
First we check Windows drive not WSL2
C:\Users[USERNAME].ssh
WSL2 SSH folder is not same as Windows Drive C SSH folder
Directory contain
- id_rsa
- id_rsa.pub
Or
- id_ed25519
- id_ed25519.pub
If you have these copy this file to WSL2 SSH folder in ~/.ssh
/home/USERNAME/.ssh
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
chmod 600 ~/.ssh/id_ed25519
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 [email protected]
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_ed25519
ssh-add ~/.ssh/id_ed25519