JavaEar 专注于收集分享传播有价值的技术资料

为什么git一直告诉我它是" 在后台自动打包存储库以获得最佳性能" ? (Why does git keep telling me it's "Auto packing the repository in background for optimum performance"?)

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.

1个回答

    最佳答案

  1. 英文原文

    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!


    中文翻译

    我从你提供的第二条评论中找到了解决方案,Trengot,谢谢。事实证明,我有一些悬挂的blob,它们位于 .git / objects / 17 中,因此触发了打包:

      $ git fsck
    悬空blob d9ff0aeac4aa8b4e0907daed675ebf60278bc977
    悬空blob dbff2d073741f9775c815d4a3c623736af224dad
    悬空blob e1ffbab1c5b985cd1cd3bc0281075ea2ed80744a
    悬空blob fdff59878ccb3a75689f4acca615cfb635288774
     

    这清理了它们:

      $ git gc --prune = now
     

    请注意,根据Henrik下面的评论,这可能有点危险。小心!

    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!

    我从你提供的第二条评论中找到了解决方案,Trengot,谢谢。事实证明,我有一些悬挂的blob,它们位于 .git / objects / 17 中,因此触发了打包:

      $ git fsck
    悬空blob d9ff0aeac4aa8b4e0907daed675ebf60278bc977
    悬空blob dbff2d073741f9775c815d4a3c623736af224dad
    悬空blob e1ffbab1c5b985cd1cd3bc0281075ea2ed80744a
    悬空blob fdff59878ccb3a75689f4acca615cfb635288774
     

    这清理了它们:

      $ git gc --prune = now
     

    请注意,根据Henrik下面的评论,这可能有点危险。小心!