gitdomaincontroller

Git commands (that use less.exe) takes too long on Windows


The following git commands take way too long to execute on my Windows PC:

Sometimes, Git throws the following error:

PS D:\SB\Code\Sharepoint_Integration> git branch
      0 [main] less (5036) C:\Users\gautamj\AppData\Local\Programs\Git\usr\bin\less.exe: *** fatal error - add_item ("\??\C:\Users\gautamj\AppData\Local\Programs\Git", "/", ...) failed, errno 1
Stack trace:
Frame         Function      Args
0007FFFFCD30  00021006116E (000210290E7A, 000210272B51, 000000008000, 0007FFFF8B30) msys-2.0.dll+0x2116E
End of stack trace
Loaded modules:
000100400000 less.exe
0005D1C20000 msys-pcre2-8-0.dll
7FFB3C1D0000 advapi32.dll
7FFB3D6A0000 msvcrt.dll
7FFB3C280000 sechost.dll
7FFB3C050000 RPCRT4.dll
7FFB3A390000 CRYPTBASE.DLL
7FFB3ACD0000 bcryptPrimitives.dll

However, commands like git add and git commit executes almost instantly, like it's supposed to. From the error, it looks like less.exe is the main reason. From my research, this occurs in PCs registered to a domain (and the problem being the domain controller), which mine happens to be. This issue only happens when I am connected to wifi. But, how do I resolve it?

EDIT: I do not face the problem when running git commands with the --no-pager flag. However, if I use the less.exe directly (say echo test | /path/to/less.exe) the problem persists.


Solution

  • This was a known bug in Git for Windows v2.41.0.windows.1

    Simply upgrading to Git for Windows v2.42.0.windows.2 solved the problem.

    Some Git commands (those producing paged output, for example) experienced a significant slow-down under certain circumstances, when running on a machine joined to a domain controller, which has been fixed.