Instructions and tools for setting up Windows 11 + WSL2 as a fast and comfortable development environment.
The idea is simple:
- keep one copy of your repositories on Windows so you can work with your regular IntelliJ installation
- keep a second copy inside Ubuntu/WSL so Docker, Kubernetes, and other Linux-based tooling can access the files with much better performance
- use
sync.shto copy the current branch state and tracked working-tree changes from the Windows repository to the matching repository inside WSL
- Install Ubuntu with WSL2.
- Install Docker Engine inside Ubuntu/WSL and configure it as needed.
- Clone your repositories into a common folder on Windows.
- Clone the same repositories into a common folder inside Ubuntu/WSL.
- Copy
sync.shto a suitable location inside your Ubuntu environment. - Edit
sync.shand update these paths:SOURCE_DIR: the Windows folder that contains your repositories, for example/mnt/c/Users/<UserName>/IdeaProjectsTARGET_DIR: the Ubuntu/WSL folder that contains the matching repositories, for example/home/<UserName>/IdeaProjects
- In IntelliJ on Windows, go to
Settings -> Tools -> External Toolsand add a new tool with these values:Program:wsl.exeArguments:-e /home/<path-to-sync.sh>/sync.sh -v $ProjectFileDir$Working directory:$ProjectFileDir$
- Optional: go to
Settings -> Appearance & Behavior -> Menus and Toolbarsand add the external tool to a toolbar for quick access.
- The repositories in Windows and Ubuntu/WSL should have matching folder names, because
sync.shmaps them by directory name. - You do not need to manually add Git remotes from the Ubuntu repositories to the Windows repositories. The script fetches directly from the corresponding Windows repository path.
- When you launch the external tool from IntelliJ,
$ProjectFileDir$is passed to the script. The script extracts the project folder name and syncs that project. - If you run
sync.shwithout a project path argument, it will try to sync all repositories underSOURCE_DIR. - The script syncs the currently checked-out branch and applies tracked working-tree changes. Untracked files and other Git state not covered by
git diffare not included.
Once everything is set up, you can:
- run your projects inside Docker on Ubuntu/WSL, which is usually much faster than running them directly from Windows, especially with a local Kubernetes cluster
- work on the code using IntelliJ on Windows, which is often more comfortable than remote development or using IntelliJ natively on Ubuntu
- sync your current tracked working-tree changes to Ubuntu/WSL with a single click; if your running services use live reload tools such as Tilt, this can trigger an automatic reload or rolling update