This note preserves the one-time setup needed when a WSL-local clone must pull from and push to GitHub over SSH.
It is not a general SSH tutorial, not a GitHub account security tutorial, and not required when all commits and pushes happen from the Windows clone.
When This Matters
Use this when the repository is cloned inside WSL, such as:
~/dev/insight-vaultThe Windows clone may still exist separately, such as:
C:\dev\insight-vaultWhen both clones exist, GitHub remains the single source of truth.
Generate An SSH Key
In WSL:
ssh-keygen -t ed25519 -C "[email protected]"When asked where to save the key, pressing Enter accepts the default path:
/home/<linux-user>/.ssh/id_ed25519For a personal WSL development environment, leaving the passphrase empty is a convenience choice. Using a passphrase is more protective but adds an unlock step.
Register The Public Key In GitHub
Print the public key:
cat ~/.ssh/id_ed25519.pubCopy the full output line into:
GitHub -> Settings -> SSH and GPG keys -> New SSH keyA clear title is enough, such as:
WSL Ubuntu 22.04Verify Authentication
Run:
ssh -T [email protected]Expected success message:
Hi <github-username>! You've successfully authenticated, but GitHub does not provide shell access.This confirms authentication. It does not open a shell on GitHub.
Use The SSH Remote
Check the remote:
git remote -vIf the remote uses HTTPS:
https://github.com/<github-username>/<repo-name>.gitSwitch it to SSH:
git remote set-url origin [email protected]:<github-username>/<repo-name>.gitVerify:
git remote -vExpected shape:
origin [email protected]:<github-username>/<repo-name>.git (fetch)
origin [email protected]:<github-username>/<repo-name>.git (push)Set Git Identity In WSL
WSL has its own Git configuration. Set the commit identity once:
git config --global user.name "<github-username>"
git config --global user.email "[email protected]"Verify:
git config --global --listCommon Mistake: Trailing Dot
Do not type:
ssh -T [email protected].The trailing dot makes SSH treat github.com. as a different host name. If this was added to known_hosts by mistake, remove it:
ssh-keygen -R github.com.Then test the correct host:
ssh -T [email protected]Working Rule
Use the WSL-local clone when Linux filesystem behavior, permissions, executable bits, debugger behavior, or /mnt/c performance becomes part of the experiment.
Otherwise, it is acceptable to keep using the Windows clone through WSL:
cd /mnt/c/dev/insight-vault