These scripts allow you to proxy commands (specifically git
, in this example) to the Windows Subsystem for Linux from the normal Windows command line environment. This allows you to work with a single installation of git (under your Linux distribution) instead of trying to manage two concurrent installations.
I explicitly created these scripts to allow using Git in Visual Studio Code without installing it under Windows.
Please note that I have not extensively tested edge cases! If you run into problems, please let me know!
- Install the scripts somewhere on your normal Windows drive; e.g.
C:\Users\USERNAME\dev\proxy_scripts
. - In VSC, modify your
settings.json
file and add thegit.path
setting pointing to yourgit.bat
file; e.g."git.path": "c:\\Users\\USERNAME\\dev\\proxy_scripts\\git.bat"
- Enjoy WSL git from the VSC GUI! (You might need to relaunch the app.)
If you want to proxy further commands, you can do so by duplicating git.bat
and changing the command that is getting invoked (so replace git
on line 6 with whatever command you want to proxy). Presumably, you could also add these scripts to your Windows PATH if you wanted to go the extra mile, though I'm not sure how that would interact with the WSL bash.exe
environment (could end up round-tripping everything uselessly, if your Windows binary locations occur earlier in the PATH than the WSL ones).
Please enjoy responsibly!
wsl-alias
offered a fantastic starting point for this approach and is a nifty project all around: https://github.com/leongrdic/wsl-aliaswsl-proxy
gave me the initial inspiration for writing simple proxy batch files: https://github.com/watzon/wsl-proxy
@alerGeek I pulled the quotation commenting directly from the wsl-alias project: https://github.com/leongrdic/wsl-alias I am not sure what prompted it to be included there, but at a guess you will run into trouble with commands in which you have escaped quotation marks if you leave that commented out. I imagine if you avoid trying to escape quotation marks prior to passing them through the proxy, you will be unlikely to run into trouble, though.