Closed lotaezhao closed 10 months ago
This problem in this case is that you don't have your Windows path added to your WSL path. It should be there automatically, and for any new user we start them off with the Windows path automatically added. Given that it's easy to have issues like this we don't call it out always on our docs to keep them concise and usually target it to the default experience. Thank you for filing this!
Documentation Issue
Setting up Git credential manager for WSL to use the windows credential manager as described on this page: https://learn.microsoft.com/en-us/windows/wsl/tutorials/wsl-git#git-credential-manager-setup
Is missing the key step of adding the windows git.exe location to the WSL path:
Open your WSL terminal, and edit the .bashrc or .bash_profile file (depending on your shell setup) using a text editor like nano or vim. Add the following line at the end of the file to append the Windows PATH to your WSL PATH:
export PATH="$PATH:/mnt/c/Program Files/Git/cmd"
If you do not add the windows git.exe location to the WSL PATH you get the following error when running git commands if you have enabled the windows credential manager:
Unhandled Exception: System.Exception: Failed to locate 'git.exe' executable on the path.
Link to documentation page
https://learn.microsoft.com/en-us/windows/wsl/tutorials/wsl-git#git-credential-manager-setup
Suggested Improvements
Add the extra step to add the git.exe location to the WSL PATH to the documentation page.