gpt4 book ai didi

Git 卡在写对象上

转载 作者:太空狗 更新时间:2023-10-29 12:50:21 28 4
gpt4 key购买 nike

我正在尝试 git push --all 但它只是卡在写入对象上

10.0-final-project git:(master) ✗ git push --all
Counting objects: 134, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (129/129), done.
Writing objects: 32% (44/134), 321.56 MiB | 231.00 KiB/s

321.56 MiB 和 231.00 KiB/s 继续上升。

我尝试过使用 git config --global http.postBuffergit config --global sendpack.sideband false

没有任何效果。解决这个问题的方法是什么?

最佳答案

看起来您已经向 GIT 添加了一个 HUGE 二进制文件或文件夹。

这不是你应该用 git 做的事情。

如果是这种情况,请考虑以下解决方案:Git Large File Storage

Another relative article可以在此处找到一些用于清理存储库的示例代码。


第 1 步:识别大文件。

We need to search through all of the history to find the files that are good candidates for deletion. As far as I can tell, this is nontrivial, so here is a complicated command that lists the sum of the sizes of all revisions of files that are over a million bytes. Run it on a mac.

git rev-list master | while read rev; do git ls-tree -lr $rev | cut -c54- |     grep -v '^ '; done | sort -u | perl -e '
while (<>) {
chomp;
@stuff=split("\t");
$sums{$stuff[1]} += $stuff[0];
}
print "$sums{$_} $_\n" for (keys %sums);
' | sort -rn >> large_files.txt

第 2 步:删除它们,就像它们从未存在过一样。

这是有趣的部分。如果 large_files.txt 的格式仍与以前相同,请执行以下操作:

git filter-branch --tree-filter 'rm -rf `cat /full/path/to/large_files.txt |
cut -d " " -f 2` ' --prune-empty <BRANCHES>

关于Git 卡在写对象上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34601295/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com