jle*_*and 26 git garbage-collection gitlab
不久前,我们已经从SVN切换到Git.
几天前,我意识到我们所有团队在推送时都会收到这些消息:
$ git push
Counting objects: 32, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (19/19), done.
Writing objects: 100% (32/32), 2.94 KiB | 0 bytes/s, done.
Total 32 (delta 14), reused 0 (delta 0)
error: The last gc run reported the following. Please correct the root cause
and remove 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.
To git@git.ad.xxx.se:root/xxx.git
15c3bbb..69e6d8b xxxx -> xxx
Run Code Online (Sandbox Code Playgroud)
我以为它来自我的电脑一段时间,直到我意识到每个人都有同样的问题.
不用说,我的.git文件夹中没有gc.log,使用'git gc'或'git prune'没有效果.
所以我的问题是:服务器上托管的存储库是不是很干净?如果是这样,我该如何清理呢?
到目前为止,我发现的所有解决方案都与存储库的本地副本有关.
此外,我们使用Gitlab来托管我们的回购.
编辑:值得一提的是,自从我发布此问题后,我还尝试使用Gitlab"清理"存储库,但到目前为止还没有结果.
谢谢
Von*_*onC 23
随后是问题14357(GitLab 8.6-或更低)
手动修复是:
rm gc.log,这只是包含了一行"警告:有太多无法到达的松散物体;运行'git prune'来移除它们."git prune,祈祷它没有破坏东西(谢天谢地没有)但看起来,启动GitLab 8.7,自动gc被禁用.
这也是在(仍然开放)问题13524的背景下完成的:
通常在需要强制推动的rebase,修正或其他操作之后,我们可能会有悬空提交.
由于
git gc可以在内部执行或使用GitLab管家功能,这种"解除引用"的提交会丢失.如果发生了特定提交附加的讨论 - 在取消引用提交被垃圾收集后,它就不可用.
提交正在推送事件中记录,并通过添加到合并请求的系统说明提供,目前这会在GitLab中产生错误500.
更新:该问题在一个月后(2016年7月)关闭,其中:
确保在Git垃圾收集运行时保持提交.
Git GC将从存储库中删除不再存在于任何分支或标记中的提交,但我们希望保留其中一些提交,例如,如果它们有注释或CI构建.
Lax*_*n G 11
我面临同样的问题,上述解决方案并没有解决我的问题。我遇到了同样的问题:
warning: There are too many unreachable loose objects; run 'git prune' to remove them.
Run Code Online (Sandbox Code Playgroud)
我已参考此链接 并运行以下命令已解决:git gc
例如:/xx/code/home/xx是我的 git 存储库主路径。
(base) laxman@xxxxx:/xx/code/home/xx$ git gc
Counting objects: 251571, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (78004/78004), done.
Writing objects: 100% (251571/251571), done.
Total 251571 (delta 141562), reused 245636 (delta 137343)
Run Code Online (Sandbox Code Playgroud)
希望它也适用于其他一些人。