Using Git in Windows Subsystem for Linux through IntelliJ

前端 未结 9 925
萌比男神i
萌比男神i 2021-01-30 11:10

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

9条回答
  •  春和景丽
    2021-01-30 11:45

    Worked till PHPSTORM 2018.3 (or maybe a Windows Update changed some behavior regarding bash.exe). I am using Ubuntu 18.04 LTS. However, the path of my bash.exe changed - it is no longer in C:\Windows\Sysnative\bash.exe.

    To get things working again I modified Elies Lou's wslgit.bat and set new path for bash.exe:

    @echo off
    setlocal enabledelayedexpansion
    set command=%*
    set find=C:\Users\%USERNAME%\AppData\Local\Temp\git-commit-msg-.txt
    set replace=/mnt/c/Users/%USERNAME%/AppData/Local/Temp/git-commit-msg-.txt
    call set command=%%command:!find!=!replace!%%
    echo | C:\Windows\System32\bash.exe -c 'git %command%'
    

提交回复
热议问题