To the surprise of some developers outside of Microsoft, my team uses Git for the vast majority of our code (10,000+ lines of code). Since we work on Windows, Git is built by using a bastardized subset of Cygwin to provide some of the POSIX facilities it requires. This generally works but there is some cruft and ugliness that occasionally rears its ugly head.
Recently, I performed a clean install of Windows 10 on my work laptop. Shortly thereafter, I started encountering a puzzling issue with Git when I was working from home. Any time I’d ask Git to do an operation that required hitting the wire or talking with the origin, it would inexplicably hang. Eventually, it would crash and spew some error that was largely meaningless.
After googling for a couple of hours, I found issue 493 on GitHub for the git-for-windows project. Apparently Git is poorly behaved with whatever changes occurred in the users/groups APIs when the machine is unable to resolve the domain controller. To mitigate this issue, a workaround was identified where you would install Cygwin and copy its settings for POSIX groups and passwd, working around Git trying to resolve the domain controller.
Assuming that your Cygwin installation was
C:\cygwin\ and that your Git for Windows installation is at
- Install Cygwin
- From a Cygwin Bash prompt, type in the following:
getent passwd $(id -u) > /etc/passwd getent group $(id -G) > /etc/group
Now, if you’re off of your office network, you should be able to push/pull without issue.
Some Side Notes
- I’m on a domain joined laptop.
- I’m using Git Credential Manager to seemlessly pass my credentials to Visual Studio Team Services (formerly VSO)