在有配额的机器上进行 git gc

发布于 2024-08-13 03:48:22 字数 328 浏览 2 评论 0原文

简单的问题,我正在尝试在具有配额的计算机上运行 git gc 。在 gc 之前,我的使用量约为 18GB,几乎所有这些都是我克隆的 git 存储库。我的磁盘限制是 25GB。在 git gc 操作期间,足够多的临时文件被写入磁盘以达到我的限制,从而导致 git gc 操作失败。

我可以在操作失败后删除 .git/objects/pack/tmp_pack_* 并恢复到 18GB 的​​使用量,但我真的很想真正完成 git gc 并恢复一点性能。

是否有一些我可以使用的奇特选项(或一系列其他 git 命令),不需要首先将大于 7GB 的临时文件写入磁盘?

Simple question, I'm trying to run git gc on a machine with a quota. Pre-gc, I'm at about 18GB of usage, almost all of which is my cloned git repository. My disk limit is 25GB. During the git gc operation, enough temporary files are written to disk to hit my limit and thus cause the git gc operation to fail.

I can delete the .git/objects/pack/tmp_pack_* after the failed operation and get back down to 18GB of usage, but I'd really like to actually complete git gc and reclaim a little performance.

Is there some fancy option (or series of other git commands) that I can use that doesn't involve first writing >7GB of temporary files to the disk?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

凑诗 2024-08-20 03:48:22

gc 的哪一部分对您来说很重要?您可以尝试分别运行 git-prune 和 git-repack 部分。使用git-prune,请确保使用--expire选项指定截止日期。如果您的存储库中有大量松散的对象,首先将它们移开会很有帮助。*

使用 git-repack,您也许可以调整深度和窗口设置来获得一些小东西足以在您拥有的空间内运行。

* 我并不假装完全理解所涉及的所有问题,但我确实注意到修剪是在 git-gc 代码中重新打包之后进行的。

Which part of the gc is important for you? You could try running the git-prune and git-repack parts separately. With git-prune, be sure and specify a cutoff date with the --expire option. If there are a ton of loose objects in your repo, getting them out of the way first would be helpful.*

With git-repack, you can perhaps mess with the depth and window settings to get something small enough to run within the space you have.

* I don't pretend to fully understand all the issues involved, but I do notice that the prune comes after the repack in the git-gc code.

凹づ凸ル 2024-08-20 03:48:22

看起来最好的解决方案是要求 IT 部门提供更大的配额,但我仍然有兴趣听到解决方法。今天他们感觉很慷慨,但明天......:)

Looks like the best solution is to ask IT for a bigger quota, though I'm still interested to hear workarounds. Today they were feeling generous, but tomorrow... :)

一口甜 2024-08-20 03:48:22

git prune 是一个很好的建议,很好的呼叫 Jefromi。

您可以做的另一件事是压缩其他文件; git gc;解压。

7z 获得惊人的压缩,但不会保留硬链接和 Unix 所有者/组、IIRC。如果您有配额,这些文件可能全部归您的帐户所有,因此不必担心第一个分数。但最安全的是 tar c --lzma(如果有的话),或者只是 tar czfcjf。如果您有很多小文件,那么高达块大小的外部(?)碎片可能会很重要。

git prune is an excellent suggestion, good call Jefromi.

Another thing you can do is compress your other files ; git gc; decompress.

7z gets amazing compression, but won't preserve hardlinks and Unix owner/group, IIRC. If you have a quota, the files are probably all owned by your account, so no worries on the first score. But the safest is tar c --lzma if you have it, or just tar czf or cjf. If you have a lot of small files, the umm, external(?) fragmentation up to block-size might be significant.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文