在git svn clone / fetch

时间:2016-03-02 04:43:23

标签: git git-svn

针对大型Subversion存储库(100k +提交)运行git svn clonegit svn fetch时,提取会定期停止:

Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
error: The last gc run reported the following. Please correct the root cause and remove .git/gc.log.
Automatic cleanup will not be performed until the file is removed.

warning: There are too many unreachable loose objects; run 'git prune' to remove them.

gc --auto: command returned error: 255

为了恢复,我必须按照说明操作,运行更积极的修剪和gc,删除日志文件并继续,只是在读取另一批10k提交后再次发生。

如何避免这个问题?

3 个答案:

答案 0 :(得分:10)

我认为如果您将配置选项gc.pruneExpire设置为now,至少在导入过程中会暂时,它会避免该消息。使用该选项集,git gc将立即删除所有无法访问的对象,而不是仅删除至少两周(默认值)的对象。加上gc.auto的合理值,这可以防止它们累积到你得到该信息的程度。

答案 1 :(得分:6)

自应答。

git svn操作是启动后台gc --auto内务操作的操作之一。在这种情况下,我认为git svn fetch的持续进展可能导致gc操作中某个点的不可到达/松散对象的数量超过auth-threshold,从而导致此警告。不幸的是,这对正在进行的获取来说是致命的。

我的解决方案是暂时禁用/怀疑这些gc操作,通过停用gc auto,如其手册页所述:

git config gc.auto 0

git svn fetch操作完成后,您可以根据需要删除此配置,并运行手动完整gc,剪枝和重新打包操作以优化最终存储库。

答案 2 :(得分:1)

开始在git pull上看到此警告:

$ git pull
remote: Enumerating objects: 22, done.
remote: Counting objects: 100% (22/22), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 22 (delta 17), reused 22 (delta 17), pack-reused 0
Unpacking objects: 100% (22/22), done.
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
error: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log.
Automatic cleanup will not be performed until the file is removed.

warning: There are too many unreachable loose objects; run 'git prune' to remove them.

Already up-to-date.

检出警告文件,那里不多:

$ cat .git/gc.log
warning: There are too many unreachable loose objects; run 'git prune' to remove them.

阅读帮助:

$ git help gc

像我们这样的声音应该定期进行

运行偶尔推荐的主动选项

$ git gc --aggressive
Counting objects: 41544, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (40544/40544), done.
Writing objects: 100% (41544/41544), done.
Total 41544 (delta 30536), reused 7801 (delta 0)
Removing duplicate objects: 100% (256/256), done.
Checking connectivity: 46959, done.

删除日志警告:

$ rm .git/gc.log 

微笑

:)