Reputation: 25
I have a git repository that at a beginning works fine (or as good as one can expect on windows), but after 1 week (or so) the repo is getting slower, when I try to run git fetch (and any command using fetch). The terminal freezes for a few minutes and then the fetch begins, the fetch itself is not particularity slow but the wait time makes it a pain.
I have tried:
git config --global core.preloadindex true
git config --global core.fscache true
git config --global gc.auto 256
git gc --aggressive --prune=now
Anyone have any idea what more I can try, I have tried google but haven't found a solution to my mystery.
Edit (2015-07-02): Added git gc --aggressive --prune=now
to tested list.
I've run:
GIT_TRACE=true git pull
trace: exec: 'git-pull'
trace: run_command: 'git-pull'
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--is-bare-repository'
trace: built-in: git 'rev-parse' '--show-toplevel'
trace: built-in: git 'ls-files' '-u'
trace: built-in: git 'symbolic-ref' '-q' 'HEAD'
trace: built-in: git 'config' 'branch.develop.rebase'
trace: built-in: git 'config' 'pull.rebase'
trace: built-in: git 'rev-parse' '-q' '--verify' 'HEAD'
trace: built-in: git 'fetch' '--update-head-ok'
trace: run_command: 'ssh' '-p' 'port' 'user@address' 'git-upload-pack '\''/repo'\''
'
trace: run_command: 'rev-list' '--objects' '--stdin' '--not' '--all' '--quiet'
#### WAITING for 2 minutes ####
remote: Counting objects: 59063, done
remote: Finding sources: 100% (124/124)
...
I've marked where the waiting time is.
Upvotes: 2
Views: 294
Reputation: 24040
If the delay is between the git pull
execution (on the client) and the remote message from the server saying remote: counting objects
then it is fragmentation on the server side that you need to address.
Run git gc --aggessive
to pack the remote repository to one or a few packfiles on the git server that you are pulling from. These will be loaded more efficiently than a selection of objects, and that in turn is likely to affect how quickly the fetch process works.
It's also possible that the machine you're running the remote server on has some kind of anti-virus scanner that's hitting each file that the Git server is loading; the more files you have (and more fragmentation) the greater the problem will be.
Edit: Updated answer to indicate where git gc needs to run, since the fragmented repository is the one that's being pulled from, not pulled to.
Upvotes: 1