2

For a long time, I was under the impression that Git on Windows was very slow. I've seen several articles and SO posts that revolve around that. I've tried several of them:

  • Disabling the __ps1 stuff
  • Adding exclusion in Antivirus software (Windows Defender)
  • Using installer instead of portable version

Today, I found another SO post which suggested using GIT_TRACE=1 to debug what's happening when a git command runs. Here's a sample output:

19:47:42.207480 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
19:47:42.211593 git.c:455               trace: built-in: git diff 0.todo
19:47:42.260647 run-command.c:666       trace: run_command: unset GIT_PAGER_IN_USE; LESS=FRX LV=-c less
diff --git a/0.todo b/0.todo
index 740ccba..1db29d6 100644

...git diff output...

This shows that the git commands themselves are not taking a lot of time. The last action which depends on less is the one taking most of the time.

I verified this by running the less command directly. It's slow. But if I run it once or twice, the subsequent runs are normal. If I close that command prompt and open a new one, the first run is very slow (5+ seconds).

I ran some other commands found within C:\Program Files\Git\usr\bin: base64, ls, etc. Same result.

So, I've concluded that this folder is the cause for the slowness of git commands on Windows. But, how do I go about fixing it? How should I debug? What more information can I provide here that'll enable someone to help me?

m01010011
  • 895
  • 8
  • 13

0 Answers0