Wslgit
:candy: Use Git installed in WSL(Windows Subsystem for Linux) from Windows and Visual Studio Code
Install / Use
/learn @hangxingliu/WslgitQuality Score
Category
Development & EngineeringSupported Platforms
README
WSLGit
Use Git installed in WSL(windows Subsystem for Linux) from Windows and Visual Studio Code.
The project was inspired by A. R. S.'s project andy-5/wslgit written by Rust.
But why do I re-implement it by scripts, because I hope the wslgit tools could support any mount points (but not only under the /mnt/) and could be used without compiling.
Usage
- Please ensure
gitis installed in your WSL. - Copy
wslgit.shto the/usr/bin/or~/bindirectory in your WSL. - Add the following config into your VSCode Settings.
{ "git.path": "C:\\path\\to\\git.bat" }
🐢 Feeling slowly? (Disable interactive shell)
wslgit launch git installed in WSL in interactive shell mode by default now.
In short, the ssh-agent setup in .bashrc script is supported. but slower then non-interactive mode.
If you want disable interactive shell to reduce launch time, you can set Windows environment variable WSLGIT_USE_INTERACTIVE_SHELL to false.
via GUI

via Powershell
[System.Environment]::SetEnvironmentVariable("WSLGIT_USE_INTERACTIVE_SHELL", "false", "User")
Update
2019-04-16
- Fixed bug caused by Windows 10 19H1 changed the output of
mountcommand- Related pull request: https://github.com/hangxingliu/wslgit/pull/13 (Thanks @kiroushi)
- Related issue: https://github.com/hangxingliu/wslgit/issues/10
2019-03-11
- BREAKING CHANGE: Start git installed in WSL in interactive mode.
- If you want to use non-interactive mode, just like before: Set Windows env variable
WSLGIT_USE_INTERACTIVE_SHELLtotrue.
- If you want to use non-interactive mode, just like before: Set Windows env variable
- Fixed error in the unix path to win path convert function.
- Related issue: https://github.com/hangxingliu/wslgit/issues/11 (Thanks @rennex)
- Added path converting for the output of
git init
Under the hood
How does it work
- Pass all arguments and env variable
WSLGIT_SH_CWDintowslgit.shin WSL when you or VSCode executegit.bat. - Get all mounted drive info by
mount -t drvfscommand inwslgit.sh. - Move cwd(current working directory) to
WSLGIT_SH_CWD. - Iterate arguments, and replace each path argument from Windows style to Linux style by reference to mounted drive info.
- And convert the path in the git output to Windows style if git arguments included special keywords/actions. (Eg.
rev-parse,remote) - Why the it doesn't use
wslpathfor path convert, please reference to the test case: test-win/main.js
How to test it
- Automatic test on Linux (also WSL): test-ci/main.sh
- Semi-automated test on Windows: CONTRIBUTING.md
How to contribute (issue/pull request)
Related links
- https://github.com/andy-5/wslgit
- https://blogs.msdn.microsoft.com/commandline/2017/11/28/a-guide-to-invoking-wsl/
Author
Contributors
License
Related Skills
apple-reminders
339.5kManage Apple Reminders via remindctl CLI (list, add, edit, complete, delete). Supports lists, date filters, and JSON/plain output.
gh-issues
339.5kFetch GitHub issues, spawn sub-agents to implement fixes and open PRs, then monitor and address PR review comments. Usage: /gh-issues [owner/repo] [--label bug] [--limit 5] [--milestone v1.0] [--assignee @me] [--fork user/repo] [--watch] [--interval 5] [--reviews-only] [--cron] [--dry-run] [--model glm-5] [--notify-channel -1002381931352]
healthcheck
339.5kHost security hardening and risk-tolerance configuration for OpenClaw deployments
node-connect
339.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
