赞
踩
$ 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'
执行如下操作(把那串代码换成你报错中的信息):
$ git rev-list --objects --all | grep e83ee47eb99f353f1aa1c7f554061f6cc8452313
输出为:
e83ee47eb99f353f1aa1c7f554061f6cc8452313 runs/1645887291/summaries/train/events.out.tfevents.1645887292.LAPTOP-OAMPS75M
证明:最大的文件是runs/1645887291/summaries/train/events.out.tfevents.1645887292.LAPTOP-OAMPS75M,大概率就是他导致的报错
因为最大的文件在runs文件夹下,所以向.gitignore文件中添加(根据个人情况修改,因为你的错因不一定是该文件):
runs/
作用是:在提交文件时忽略runs文件夹下的所有文件。
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
若改行代码报错:Cannot rewrite branches: You have unstaged changes
解决方案:先执行:git stash
,再执行一遍该命令即可。
git push origin master
虽然上面我们已经删除了文件, 但是我们的repo里面仍然保留了这些objects, 等待垃圾回收(GC), 所以我们要用命令彻底清除它, 并收回空间,命令如下:
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。