Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Git on WSL2 with SouceTree so slow for me?

My environment is as follows.

  • Windows10(version 2004, build 19041.572)
  • 64 bit OS
  • On WSL2, I use Ubuntu(Ubuntu-20.04)
  • I use git with SourceTree.

I use docker-compose to develop Web services. Running docker-compose on Windows is very slow for accessing web pages. I created a docker environment in the Ubuntu's Home folder on WSL2. Web site data (Laravel) is installed in the docker environment on WSL2 and managed by git.

How can i improve the speed of SourceTree on WSL2? Git on Windows is faster.

like image 457
zenzenzenfone Avatar asked Nov 05 '20 02:11

zenzenzenfone


People also ask

Why is my SourceTree so slow?

Long Version: Had this issue with large repository (has many files). Investigated and found root cause of SourceTree slowness. If you find git status -uall is super slow (same slowness as SourceTree then this is likely your culprit). Sourcetree always uses -uall when doing status refreshes.

Why is WSL2 so slow?

WSL2 uses the 9P protocol to access Windows drives, and it is currently known to be very slow when compared to: Native NTFS (obviously) The ext4 filesystem on the virtual disk used by WSL2. And even the performance of WSL1 with Windows drives.

Is WSL2 slower than Windows?

File performance across the Windows and Linux operating systems is faster in WSL 1 than WSL 2, so if you are using Windows applications to access Linux files, you will currently achieve faster performance with WSL 1.


2 Answers

Unfortunately WSL2 has an issue with filesystem performance on /mnt.

Might be an option to checkout your repo into container's /home, instead of /mnt/..., if you don't need to edit it from windows.

Running Docker from a Linux container on windows will not help.

UPD: The same issue can appear on a large project w/o mounting anything, but still accessing repo inside WSL by \\wsl$ path from Windows. The issue still open.

like image 187
vovchisko Avatar answered Oct 20 '22 15:10

vovchisko


My solution is to use git tasks/command inside the IDE that supports WSL.

I use Visual Studio Code inside WSL 2 and use git extensions to do git tasks/commands. The performance is superb! :-D

like image 32
nelsonym Avatar answered Oct 20 '22 17:10

nelsonym