6
You are not supposed to access Linux files and utilities directly from Windows apps. So giving the path directly is not a good thing to do.
You should call it as bash -c "git"
, or if needed, put the call into a batch file so that Windows app will call that file instead of the Linux app.
You also need to translate the path between Windows and Linux because git in WSL won't understand things like D:\my project\src
. Previously the conversion must be done manually, however MS has included wslpath
since Windows 10 1803 for that purpose.
You can also install an add-on to do all the translation and heavy lifting for you. In VSCode there's wslgit and JetBrains has WSL Support Framework. I'm not sure about Android Studio but this answer suggests that gitwrap can be used
Read more Interop between Windows and Bash
Hrrrmmm.. I do this ALL OF THE TIME.. What you don't want to edit are files under the virtual paths that AREN'T under /mnt/*. You can run a windows command, pipe to a linux command and pipe it back to a windows command. I use linux netbeans under windows and edit the files from both sides. What can become confusing is if case sensitivity gets enabled without knowing it.. – Señor CMasMas – 2019-03-07T20:51:05.323
1
I was not able to get it working from IntelliJ. Even with a shell the test in IntelliJ kept complaining. You can follow this tutorial to start IntelliJ from inside WSL: https://gist.github.com/wsargent/072319c2100ac0aea4305d6f6eeacc08
Havn't tried it myself but it's rumored to be laggy.
2
I would not try and run Linux programs from WSL inside of a Windows program; you're going to need Win32 apps, not WSL apps, to work with the Windows tools. There is Git for Windows, though, and I know it does work.
– Thomas Ward – 2016-12-27T15:11:36.987Note to mods/reviewers: that I migrated this from Ask Ubuntu, because this asks "How can I use a WSL program from a native Windows program", which would be offtopic on Ask Ubuntu, as it asks a Windows question rather than a Linux question. – Thomas Ward – 2016-12-27T15:16:48.163
can you wrap it inside an
*.sh
file and call to that script in your program? – phuclv – 2016-12-27T15:45:46.703git runs 'fine' under WSL.. by 'fine' I mean slower than dirt.. but it works 100% – Señor CMasMas – 2019-03-07T20:53:31.207