Virtualization makes obvious how many abstractions exists composing our workflow because something will break. Coming from a decade using Unix and Vim as my IDE this is what I've learned while using WSL2 and Windows.
Windows Home
: Your private user folder on Windows ($USERPROFILE%
env var)WSL Home
: Your home inside the Linux Distro ($HOME
env var)WSLrc
: Init script inside WSL (eg:~/.bashrc
,~/.zshrc
,~/.bash_profile
, etc)
You SHOULD prefer accessing WSL files from Windows, not the other way around. Example of sharing sources files between WSL and Windows:
- Create a
~/src
inside WSL - Use
\\wsl$\$HOME
Network Folder on Windows
On WSL you have access to Windows files through /mnt/c
mount, which works but
is slower and some ramdom things might not work (ex: Hot reload on NodeJS apps).
For an acceptable performance while using Git on WSL2, you MUST install Git on Windows. To use Windows binary inside WSL, add this to your WSLrc:
git()
{
git.exe "$@"
}
export -f git
Git configuration SHOULD be on Windows Home (%USERPROFILE\.gitconfig
), SSH
information should also be there (%USERPROFILE%\.ssh\config
).
Please don't do any of it.
Treat both systems as independent and don't try to integrate them for might end up with:
.gitattributes
will eventually get messed upUse WSL as you would use a remote server: