Git/Bash is extremely slow in Windows 7 x64

I've been using Git on both Windows and Ubuntu during the development of a small project, frequently flipping back and forth between the two. The issue I'm having is that Git/Bash consistently become slow. When I say slow, I mean that running cd takes anywhere from 8-25 seconds, running git commands take from 5-20 seconds, and ls can take up to 30 seconds sometimes. Needless to say, this is not fun, not to mention unproductive. I know Git is slower on Windows, but this is ridiculous.

The one solution which has worked--temporarily--for me has been to disable my network connection (as suggested in this answer), start git, and then reconnect. Sometimes it continues to run quickly for days after doing that, but the performance always degrades eventually. I've trawled through the msysgit discussion group, SO, msysgit issue list, etc. on and off for weeks, but I haven't been able to turn up solutions which work.

So far, I've tried:

  • Adding git & project folders to virus scanner's exclusion list
  • Disabling my virus scanner completely (Kaspersky IS 2011)
  • Ensuring that Outlook is not running (Outlook 2007)
  • Shutting down all other applications
  • Running git as administrator
  • Disabling network connection, starting git, and keeping connection disabled
  • Disabling network connection, starting git, re-enabling connection (works only occasionally)
  • Running git gc
  • And combinations of the above
  • I did read that a couple people had success disabling bash completion, but ideally I'd like to keep that active. The version of msysgit is 1.7.3.1-preview20101002 & the OS is Windows 7 x64. Running the same things on Linux is, predictably, lightning fast. I would use Linux exclusively, but I need to run stuff in Windows, too (certain apps, testing, etc.).

    Has anyone encountered a similar issue? If so, what was the underlying problem and what was the solution (if any)?

    Edit: This extends beyond just the git repositories, but just for reference, the repos I've been using git with have been pretty small: ~4-50 files max.


    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 admin (update: enabled by default in Git for Windows 2.8)

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


  • Do you have Git information showing in your Bash prompt? If so, maybe you're inadvertently doing way too much work on every command. To test this theory try the following temporary change in Bash:

    export PS1='$'
    

    My Windows home directory is on the network, and I suspected that Git Bash commands were looking there first. Sure enough, when I looked at $PATH, it listed /h/bin first, where /h is a share on a Windows file server, even though /h/bin doesn't exist. I edited /etc/profile and commented out the export command that puts it first in $PATH:

    #export PATH="$HOME/bin:$PATH"
    

    This made my commands run much faster, probably because Git Bash is no longer looking across the network for the executables. My /etc/profile was c:Program Files (x86)Gitetcprofile.

    链接地址: http://www.djcxy.com/p/43566.html

    上一篇: Git服务器像GitHub?

    下一篇: Git / Bash在Windows 7 x64中速度非常慢