Tl;dr
On Windows, when the PC is in a domain, make sure that the domain controller is reachable.
Details
The shell and command line tools that are distributed with Git for Windows are derived from the MSYS2 project, which is based on a variant of the Cygwin library. As part of the program startup routine, the library does several name lookups. When the system is registered in a domain, this lookup goes to the domain controller. In the case when the domain controller is not reachable, the lookup waits for time-outs. This causes the delays.
The results of the lookup is cached by Windows. Therefore for a short time, subsequent startups do not have to wait for the time-outs. But ultimately the cache expires and the next program invocation has to wait again.
The Git program, git.exe
, is not based on the Cygwin library and does not need the name lookup. It can run without delay. However, many Git commands spawn a pager, typically less
, which does suffer from the delay; therefore, it appears as if Git itself would be delayed. (Not that it matters; the user experience is bad either way.)
On top of that there are many other cases where Git runs a command line tool: hooks, textconv filters, ssh, etc. All of them can suffer from the delay.
EDIT: I am currently testing the following change.
Do NOT make this change to your system unless you know exactly what the security implications are.
I used mkpasswd
and mkgroup
to cache the current domain information locally:
mkpasswd >> /etc/passwd
mkgroup >> /etc/group
Then I removed duplicates from the files. (But /etc/group
did not exist before these commands.)
This idea was taken from the Cygwin FAQ.