# Synchronizing ssh keys between Windows and WSL

14 Jan 2021

WSL stands for Windows Subsystem for Linux, it runs a native Linux distribution inside Windows. With the recent changes introduced with WSL-2, it is now really easy to synchronize the ssh keys between Windows and WSL. Here's how I did it.

## Git for Windows

On windows, I use Git for Windows, for which ssh keys can be configured inside this directory :

%userprofile%/.ssh


To synchronize the ssh keys and ssh config file between windows and wsl, it is enough to link ~/.ssh to this directory and update the permissions as follows:

ln -s /mnt/c/Users/<username>/.ssh ~/.ssh
chmod 700 ~/.ssh
chmod 600 ~/.ssh/*


## WSL Git

An alternative is to use WSLGit which will let you use the git inside WSL in windows.

However, with this solution, you can't configure native Windows line endings in git.

Other articles you might like: