当前位置:   article > 正文

Git报错解决:remote: error: File:1f6cc8452313 157.10 MB, exceeds 100.00 MB_remote: error: file: 5670c15c64dd820e61d8113508ff7

remote: error: file: 5670c15c64dd820e61d8113508ff7af99b6b5669 149.14 mb, exc

完整报错

$ git push origin master
Enumerating objects: 25, done.
Counting objects: 100% (25/25), done.
Delta compression using up to 12 threads
Compressing objects: 100% (17/17), done.
Writing objects: 100% (21/21), 114.94 MiB | 1.75 MiB/s, done.
Total 21 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Powered by GITEE.COM [GNK-6.2]
remote: error: File: e83ee47eb99f353f1aa1c7f554061f6cc8452313 157.10 MB, exceeds 100.00 MB.
remote: Use command below to see the filename:
remote: git rev-list --objects --all | grep e83ee47eb99f353f1aa1c7f554061f6cc8452313
remote: Please remove the file from history and try again. (https://gitee.com/help/articles/4232)
To gitee.com:ccql/dnr-bisher.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'gitee.com:ccql/dnr-bisher.git'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

解决措施

step1:查找最大文件

执行如下操作(把那串代码换成你报错中的信息):

$ git rev-list --objects --all | grep e83ee47eb99f353f1aa1c7f554061f6cc8452313
  • 1

输出为:

e83ee47eb99f353f1aa1c7f554061f6cc8452313 runs/1645887291/summaries/train/events.out.tfevents.1645887292.LAPTOP-OAMPS75M
  • 1

证明:最大的文件是runs/1645887291/summaries/train/events.out.tfevents.1645887292.LAPTOP-OAMPS75M,大概率就是他导致的报错

step2:修改.gitignore文件

因为最大的文件在runs文件夹下,所以向.gitignore文件中添加(根据个人情况修改,因为你的错因不一定是该文件):

runs/
  • 1

作用是:在提交文件时忽略runs文件夹下的所有文件。

step3:在提交中删除该文件

git filter-branch --force --index-filter  "git rm --cached --ignore-unmatch runs/1645887291/summaries/train/events.out.tfevents.1645887292.LAPTOP-OAMPS75M"  --prune-empty --tag-name-filter cat -- --all
  • 1

若改行代码报错:Cannot rewrite branches: You have unstaged changes
解决方案:先执行:git stash,再执行一遍该命令即可。

step4:重新提交

git push origin master
  • 1

step5:清理垃圾

虽然上面我们已经删除了文件, 但是我们的repo里面仍然保留了这些objects, 等待垃圾回收(GC), 所以我们要用命令彻底清除它, 并收回空间,命令如下:

rm -rf .git/refs/original/
 
git reflog expire --expire=now --all

git gc --prune=now
  • 1
  • 2
  • 3
  • 4
  • 5
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/寸_铁/article/detail/806657
推荐阅读
相关标签
  

闽ICP备14008679号