为什么git会告诉我它是“自动打包后台中的存储库以获得最佳性能”? [英] Why does git keep telling me it's "Auto packing the repository in background for optimum performance"?
问题描述
在我的一个git仓库中,每次调用(例如) git fetch
,git打印:
在后台自动打包存储库以获得最佳性能。
请参阅git help gc进行手动管理。
每当我做一个 git fetch code>,即使没有任何更改,也没有任何操作可以执行
git fetch
。这对我来说没有多大意义。它似乎也发生在其他网络操作上,例如 git push
和 git pull
。
该命令立即返回到提示,不再输出,并且我找不到在我的机器上运行的任何git进程。它似乎只发生在这个存储库中,并且只在这台机器上发生。 git config -l | grep gc
不会返回任何结果。
我能做些什么来诊断或修复这个问题?
$ git --version
git版本2.0.1
我使用OS X 10.9。
我从您提供的第二条评论中找到了解决方案,谢谢。事实证明,我有一些晃来晃去的斑点,它们位于 .git / objects / 17
中,因此触发打包:
$ GIT中的fsck
悬空团块d9ff0aeac4aa8b4e0907daed675ebf60278bc977
悬空团块dbff2d073741f9775c815d4a3c623736af224dad
悬空团块e1ffbab1c5b985cd1cd3bc0281075ea2ed80744a
悬空团块fdff59878ccb3a75689f4acca615cfb635288774
> $ git gc --prune = now
请注意,根据Henrik的评论,这可能是有点危险。保重!
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.
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!
这篇关于为什么git会告诉我它是“自动打包后台中的存储库以获得最佳性能”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!