Copy SSH Keys from WSL2 to Windows

Janne Kemppainen |

You may have generated an SSH key pair that you use with git on Windows Subsystem for Linux. But if you also want to use Git for Windows then you might want to reuse the same key on the Windows side so that you don’t need to maintain more keys on the remote, such as GitHub.

By default, Git for Windows looks for SSH keys from the .ssh/id_rsa file located under your home directory. It’s also the same path on the WSL2 side, though on a different file system.

Just use cp to make a copy of the id_rsa file under your home folder, and Git for Windows should start working right away:

$ cp ~/.ssh/id_rsa /mnt/c/Users/Janne/.ssh/id_rsa

Just be sure to change the correct username in the path!

You might also find my other post Using Git with Multiple Accounts interesting!

Subscribe to my newsletter

What’s new with PäksTech? Subscribe to receive occasional emails where I will sum up stuff that has happened at the blog and what may be coming next.

powered by TinyLetter | Privacy Policy