为什么 git 一直告诉我它是“在后台自动打包存储库以获得最佳性能”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28633956/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why does git keep telling me it's "Auto packing the repository in background for optimum performance"?
提问by Andrew Ferrier
Note: I don'tthink this is a duplicate of this question, which is talking about a non-background pack which hangsgit with a subtly different error message.
注意:我不认为这是这个问题的重复,它是在谈论一个非背景包,它挂起git并带有一个微妙不同的错误消息。
In one of my git repositories, each time I invoke (for example) git fetch
, git prints:
在我的一个 git 存储库中,每次我调用 (例如) 时git fetch
,git 都会打印:
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
.
如果我git fetch
反复执行,似乎每次都会打印此内容,即使没有更改也无事可做git fetch
。这对我来说没有多大意义。它似乎也发生在其他网络操作中,例如git push
和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.
该命令立即返回到提示符,没有进一步的输出,而且我找不到任何在我的机器上运行的 git 进程。它似乎只发生在这个存储库中,并且只发生在这台机器上。git config -l | grep gc
什么都不返回。
What can I do to diagnose or fix this problem?
我能做些什么来诊断或解决这个问题?
$ git --version
git version 2.0.1
I am using OS X 10.9.
我使用的是 OS X 10.9。
回答by Andrew Ferrier
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:
我从你提供的第二条评论中找到了解决方案,Trengot,谢谢。事实证明,我有一些悬空的斑点,它们在里面.git/objects/17
并因此触发了包装:
$ 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!
请注意,根据下面 Henrik 的评论,这可能有点危险。小心!