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.
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/
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.
For me the issue was the use __git_ps1 in the shell prompt - I guess due to slow disk access in msysgit.
Solution was to remove $(__git_ps1) from the PS1=... lines in /etc/profile
quick test if this solution applies: in a git shell, type export PS1='$ ' and check the speed of your operations.
Tried just about all tips here (including the one from my other answer) on a new machine, but they didn't work, Git still slow as hell.
Then I had a look at the virusscanning software (that was pre-installed) : I disabled McAfee Security Center's realtime scanning, and presto: git is blazing fast now! Time needed for "git svn rebase" dropped from 30s to 5s (!).
I hope this is helpful to other people still having issues with slow Git on Windows, I lost hours figuring this out.