

#PHPSTORM WSL2 FOR WINDOWS 10#
Docker Desktop WSL 2 backend has now been available for a few months for Windows 10 insider users and Microsoft just released WSL 2 on the Release Preview channel (which means GA is very close). This entry was posted in Coding, Software, WordPress and tagged Git, PhpStorm, Windows Subsystem for Linux, WSL. Questions? Problems? Leave a comment below. Verify that it works by clicking the Test button. In PhpStorm, go to File → Settings (or Default Settings) → Version Control → Git and set the “Path to Git executable” to point at the batch file. Set replace=/mnt/c/Users/%USERNAME%/AppData/Local/Temp/git-commit-msg-.txtĬall set command=%%command:!find!=!replace!%%Ĭ:\Windows\sysnative\bash.exe -c 'source ~/.viper-common git %command%'īash.exe -c 'source ~/.viper-common git %command%' Set find=C:\Users\%USERNAME%\AppData\Local\Temp\git-commit-msg-.txt So as a part of my batch script, I’m manually loading my personal file that contains my shell customizations. bashrc file wasn’t being loaded when calling bash.exe -c which meant that agent wasn’t being loaded. This Stack Overflow question helped me a ton, but I needed to modify it a little bit.įor whatever reason, my.

The trick here is instead of having PhpStorm use git.exe, you need to point it at a batch script. Now that you have Git authentication working within Linux, it’s time to get PhpStorm (or whatever IDE you use) to use Linux’s Git.


#PHPSTORM WSL2 INSTALL#
Install weasel-pageant to allow you to use SSH keys from within Linux.Note that command line ssh won’t work because it’s not Pageant-compatible. GitHub won’t let you open a shell but it’ll let you know that you have successfully authenticated. Verify that the agent is working by using PuTTY to connect to with the username git.Have it start with Windows in order to load your SSH keys. Install Pageant from PuTTY or if you’re signing your commits, then Gpg4win (its gpg-connect-agent can be set to be PuTTY compatible).
#PHPSTORM WSL2 HOW TO#
This blog post will explain how to get it to use the copy of Git within Linux. IDEs such as PhpStorm do all of their Git operations from Windows. If you build your project in Linux but attempt to commit from Windows, it won’t work. The main time that this bites you is when the project you’re working on has a pre-commit hook in Git. This is largely because building in one environment means that you can’t run the tools in the other environment. While it’s possible to build Node.js-powered projects natively under Windows thanks to the Windows-Build-Tools package, it’s a lot easier to just do everything within Linux. I can now run pretty much any Bash script without having to spin up a virtual machine like I used to have to. I’m one of the rare Windows users at Automattic but thanks to the introduction of Windows Subsystem for Linux, my life is way easier.
