andy-5 / wslgit

Use Git installed in Bash on Windows/Windows Subsystem for Linux (WSL) from Windows and Visual Studio Code (VSCode)
MIT License
1.19k stars 59 forks source link

How to use wslgit for WSL workspaces only? #88

Closed mwittmann closed 4 years ago

mwittmann commented 4 years ago

I need to use a native Windows git (like "Git for Windows") for Windows-only projects, and want to use wslgit for projects hosted under WSL. However, it seems (per https://code.visualstudio.com/docs/getstarted/settings#_settings-and-security) that the "git.path" can only be set at the user level and not per-workspace. Is there a workaround? Or do you have a suggestion for how best to manage this? Thanks!

andy-5 commented 4 years ago

I'm not quite sure what you are trying to achieve. For wslgit.exe, the project still needs to be on the Windows side. It only uses the version of Git installed inside WSL.

I think you may be looking for the VS Code Remote - WSL extension. This extension enables you to open a WSL directory in VS Code. And I believe it then also uses Git from the WSL environment. So, using this extension, you could use different versions of git on a per-workspace basis.

Please let us know if this extension works for you, or if I misunderstood what you are trying to do.

mwittmann commented 4 years ago

I have native Windows software projects that use git, and I want to use git on the Windows side with Windows-specific settings for those. I also have WSL Linux projects that use git, and for those I want to use the git on the WSL Linux instance (Ubuntu). However, as I understand it, VS Code does not allow git to be configured per workspace but only at the user level. I was wondering if you knew of a solution.

Thanks for the pointer to "VS Code Remote -WSL". I will give it a try. Does it, in your opinion, obviate the need for this WSL-git project? (I tried a VS Code Remote version for working on a remote Linux server via SSL and found it to perform poorly and unreliably, but perhaps for a local WSL instance it would not have those issues.)

andy-5 commented 4 years ago

I only tried it briefly, but for local development inside WSL it seems to work quite well. Using this extension, you don't need wslgit at all, unless you want to use the WSL version of Git outside of VS Code too.

mwittmann commented 4 years ago

And I do kind of have a fondness for command line git! Thanks for the follow-up.