Executing Linux programs (WSL) from Windows environment
Solution 1:
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
Solution 2:
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.