MicrosoftDocs / WSL

Source code behind the Windows Subsystem for Linux documentation.
https://docs.microsoft.com/windows/wsl
Other
1.89k stars 556 forks source link

Path to windows git.exe not mentioned as required step to setup git credential manager in WSL #1796

Closed lotaezhao closed 10 months ago

lotaezhao commented 12 months ago

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.

craigloewen-msft commented 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!