4/7/2017 - 8:49 PM

Trying to get PhpStorm to use git in Bash on Ubuntu on Windows (Windows Subsystem for Linux)

Trying to get PhpStorm to use git in Bash on Ubuntu on Windows (Windows Subsystem for Linux)

There's a problem that you run into right away: you can't put a command line command, with arguments, 
into the path to git executable box.

So putting something like bash.exe -c "git %*" isn't going to work. I wrote a small shell script that
fixes this, for both 32-bit and 64-bit systems.

@echo off
	"C:\Windows\sysnative\bash.exe" -c "git %*"
) Else (
	"bash.exe" -c "git %*"

If you set this script as the path to the git executable you'll get the correct git version back when
you hit the test button. You'll be able to use many of the local VCS functions, like viewing diffs or
previous commits. It should be noted that if you're on a 64 bit system you can't simply ignore the x86
portion of the script, even if you run the 64 bit executable of PhpStorm, the VCS handling is 32 bit.
Or at least when this script is actually invoked it will fail if it can't run the 32 bit version.

Everything falls apart when you try to pull or push from a remote. If you watch the log the reason is 
obvious: However the handling of private keys and/or passwords works, it doesn't work here. If you
cancel an attemp to fetch updates you'll get a few messages in the log about not being able to 
authenticate with private key or password.

If I run my script in a windows command shell it works fine, it prompts me for a password and fetches 
updates. For whatever reason that request for a password isn't making it into PhpStorm.

For now, I give up. Really, and I know it's unlikely, but I would like to see WSL supported because 
there's a ton of tools in PhpStorm that assume you aren't doing something stupid like running a 
different OS within your OS and trying to pipe all your commands into it while NOT doing this in a 
VM where you could just run a SSH server.