Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Msysgit bash is horrendously slow in Windows 7

I love git and use it on OS X pretty much constantly at home. At work, we use svn on Windows, but want to migrate to git as soon as the tools have fully matured (not just TortoiseGit, but also something akin the really nice Visual Studio integration provided by VisualSVN). But I digress...

I recently installed msysgit on my Windows 7 machine, and when using the included version of bash, it is horrendously slow. And not just the git operations; clear takes about five seconds. AAAAH!

Has anyone experienced a similar issue?


Edit: It appears that msysgit is not playing nicely with UAC and might just be a tiny design oversight resulting from developing on XP or running Vista or 7 with UAC disabled; starting Git Bash using Run as administrator results in the lightning speed I see with OS X (or on 7 after starting Git Bash w/o a network connection - see @Gauthier answer).

Edit 2: AH HA! See my answer.

like image 204
Kevin L. Avatar asked May 14 '10 16:05

Kevin L.


2 Answers

You can significantly speed up Git on Windows by running three commands to set some config options:

git config --global core.preloadindex true git config --global core.fscache true git config --global gc.auto 256 

Notes:

  • core.preloadindex does filesystem operations in parallel to hide latency (update: enabled by default in git 2.1)

  • core.fscache fixes UAC issues so you don't need to run Git as administrator (update: enabled by default in Git for Windows 2.8)

  • gc.auto minimizes the number of files in .git/

like image 98
shoelzer Avatar answered Sep 19 '22 21:09

shoelzer


The solution for slowness on Vista or 7 appears to be running Git Bash using Run as administrator (or disabling UAC for the Git Bash shortcut...or disabling UAC entirely). The difference is night and day and using git on 7 is awesome again.

This appears to be related to a known issue and, as I speculated, XP as a development environment for msysgit is partially responsible.

like image 23
Kevin L. Avatar answered Sep 17 '22 21:09

Kevin L.