Git陷入写作对象的困境

问题描述 投票:6回答:2

我正在尝试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 github git-push
2个回答
8
投票

看起来你已经向GIT添加了一个巨大的二进制文件或文件夹。

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

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

Another relative article可以在这里找到一些清洁回购的示例代码。


Step 1: Identify the large files.

我们需要搜索所有历史记录以找到适合删除的文件。据我所知,这是非常重要的,所以这里有一个复杂的命令,列出了超过一百万字节的所有文件修订版本的大小总和。在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

Step 2: Remove them like they were never there.

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

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

7
投票

我遇到了同样的问题。但原因是当前用户没有对目标目录的写入权限。

© www.soinside.com 2019 - 2024. All rights reserved.