Skip to content

qaware/fast-wsl2-developing-environment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

fast-wsl2-developing-environment

Instructions and tools for setting up Windows 11 + WSL2 as a fast and comfortable development environment.

Overview

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.sh to copy the current branch state and tracked working-tree changes from the Windows repository to the matching repository inside WSL

Setup

  1. Install Ubuntu with WSL2.
  2. Install Docker Engine inside Ubuntu/WSL and configure it as needed.
  3. Clone your repositories into a common folder on Windows.
  4. Clone the same repositories into a common folder inside Ubuntu/WSL.
  5. Copy sync.sh to a suitable location inside your Ubuntu environment.
  6. Edit sync.sh and update these paths:
    • SOURCE_DIR: the Windows folder that contains your repositories, for example /mnt/c/Users/<UserName>/IdeaProjects
    • TARGET_DIR: the Ubuntu/WSL folder that contains the matching repositories, for example /home/<UserName>/IdeaProjects
  7. In IntelliJ on Windows, go to Settings -> Tools -> External Tools and add a new tool with these values:
    • Program: wsl.exe
    • Arguments: -e /home/<path-to-sync.sh>/sync.sh -v $ProjectFileDir$
    • Working directory: $ProjectFileDir$
  8. Optional: go to Settings -> Appearance & Behavior -> Menus and Toolbars and add the external tool to a toolbar for quick access.

Important notes

  • The repositories in Windows and Ubuntu/WSL should have matching folder names, because sync.sh maps 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.sh without a project path argument, it will try to sync all repositories under SOURCE_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 diff are not included.

Result

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

About

Instructions and tools on how to properly set up Win 11 + WSL for a fast and comfortable development environment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages