I\'m trying to set Git executable in IntelliJ to be the git installed in Windows Subsystem for Linux, I tried a few different ways, but always got some sort of error. Today I in
As Gabrielizalo answered earlier, you need to use version 2020.2 and higher.
Go to Settings | Version Control | Git
Add \\wsl$\YOUR-WSL-VERSION\usr\bin\git
to the Path to Git executable.
Please note, if you are using the WLinux distribution, you need to use the name Pengwin.
Even though the wsl -l
command outputs the name as WLinux. Perhaps It will be fixed in future versions.
This is how it works for me \\wsl$\Pengwin\usr\bin\git
.
In PyCharm 2018.1 I got various errors, when trying to settled up Git. I've to combine different approaches to make it run. Next code works for me:
@echo off
setlocal enabledelayedexpansion
set command=%*
If %PROCESSOR_ARCHITECTURE% == x86 (
echo | C:\Windows\sysnative\bash.exe -c 'git %command%'
) Else (
echo | bash.exe -c 'git %command%'
)
UPD:
Now is available integration with Git inside WSL through WSLGit wrapper. I've checket it out with PyCharm and it's work like a charm. Here is a link https://github.com/andy-5/wslgit
Change the double to single quotes.
You can log, what arguments are fed to your bat file
@echo off
@echo %*>> %~dp0log.txt
bash.exe -c 'git %*'
With that, i discovered i had some escaping problems.
FYI: With the Win10 creators update piping bash and spawning it from Windows programs works fine.
Since WebStorm 2020.2 EAP it is possible.
Just add \\wsl$\YOUR-WSL-VERSION\usr\bin\git
to the Path to Git executable:
To get your WSL VERSION
type in a console wsl -l
In PhpStorm (2017.2 EAP) I get error
Caused by: com.intellij.openapi.vcs.VcsException: 'bash.exe' is not recognized as an internal or external command, operable program or batch file.
For solution i change last line to
If %PROCESSOR_ARCHITECTURE% == x86 (
C:\Windows\sysnative\bash.exe -c 'git %command%'
) Else (
bash.exe -c 'git %command%'
)
For me this solution works:
File: git.bat
@echo off
setlocal enabledelayedexpansion
set command=%*
If %PROCESSOR_ARCHITECTURE% == x86 (
C:\Windows\sysnative\bash.exe -c 'git %command%'
) Else (
bash.exe -c 'git %command%'
)