Why does git keep telling me it's "Auto packing the repository in background for optimum performance"?

43,149

I found the solution from the second comment you provided, Trengot, thanks. It turns out that I had some dangling blobs, which were in .git/objects/17 and hence triggering the packing:

$ git fsck
dangling blob d9ff0aeac4aa8b4e0907daed675ebf60278bc977
dangling blob dbff2d073741f9775c815d4a3c623736af224dad
dangling blob e1ffbab1c5b985cd1cd3bc0281075ea2ed80744a
dangling blob fdff59878ccb3a75689f4acca615cfb635288774

This cleaned them up:

$ git gc --prune=now

Be aware, as per Henrik's comment below, this may be a little dangerous. Take care!

Share:
43,149

Related videos on Youtube

Andrew Ferrier
Author by

Andrew Ferrier

IBM MobileFirst Platform (Worklight), Mobile & Dojo expert. Work with a wide ranging of mobile and web technologies and platforms. Lead IBM's EMEA Pan-IOT Mobile Software Services Team.

Updated on January 21, 2020

Comments

  • Andrew Ferrier
    Andrew Ferrier over 4 years

    Note: I don't think this is a duplicate of this question, which is talking about a non-background pack which hangs git with a subtly different error message.


    In one of my git repositories, each time I invoke (for example) git fetch, git prints:

    Auto packing the repository in background for optimum performance.
    See "git help gc" for manual housekeeping.
    

    It appears to print this every time if I do a git fetch repeatedly, even when there are no changes and nothing for git fetch to do. This doesn't make a lot of sense to me. It also seems to happen with other network operations, such as git push and git pull.

    The command returns back to the prompt instantly with no further output, and I cannot find any git process running on my machine. It seems to happen only with this repository, and only on this machine. git config -l | grep gc returns nothing.

    What can I do to diagnose or fix this problem?

    $ git --version 
    git version 2.0.1
    

    I am using OS X 10.9.

    • Holloway
      Holloway over 9 years
      It looks like the same problem as the question you linked, but just happening fast enough to not appear to hang.
    • Holloway
      Holloway over 9 years
    • Andrew Ferrier
      Andrew Ferrier over 9 years
      Trengot, I don't think so. The error message is subtly different - it mentions "the background".
  • Matstar
    Matstar over 7 years
    Thanks! This seemed to work for me. Be aware that --prune=now is a little bit dangerous. By default, --prune will keep 2 weeks of dangling blobs, meaning that if you accidentally did an incorrect rebase 5 minutes ago, or removed a branch yesterday, you can recover. Once you run this command, you lose all dangling blogs until right now – not 2 weeks ago. Also, it seems like you should never run it while performing other Git commands in another terminal, or your repo can become corrupt.
  • Shrikant Phadke
    Shrikant Phadke over 3 years
    It never occurred before. for me worked by 'git clean -fd'. strange but It might be because of untracked files.