WSL Git Error – “Error: Permission denied (publickey)”

If you are using Windows Subsystem for Linux (WSL) with VS Code and receive the following error we have a fix for you.

Error Details

When trying to clone and Git Repo inside WSL, you receive the following error.

Error: Permission denied (publickey)

If you followed all the Git and GitHub SSH configuration, created an SSH key, and uploaded it to GitHub, you need to make sure you start WSL as Administrator.

To start VS Code as Administrator, Right Click on VS Code icon and select Run as administrator. This will give WSL enough permission to download repos to the WSL file system.

Don’t run git clone with sudo. Git needs to run as a regular user.


Posted

in

,

by