Git提交大文件报错“remote: Please remove the file from history and try again. ”

文章讲述了在Git操作中遇到的因大文件导致仓库大小超出限制的错误,提供了通过`gitrev-list`查看大文件并使用`gitfilter-branch`和`gitpush`进行历史修改和推送的解决方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

如在使用Git过程中不小心将较大的二进制文件加入仓库,那么仓库大小很快就会超过规定的配额,在Push的时候会报下面的错误:

remote: Powered by GITEE.COM [GNK-6.4]
remote: error: File: c91e5de4f55bedd0669db01036fc131ea8e516ce 130.66 MB, exceeds 100.00 MB.
remote: Use command below to see the filename:
remote: git rev-list --objects --all | grep c91e5de4f55bedd0669db01036fc131ea8e516ce
remote: Please remove the file from history and try again. (https://gitee.com/help/articles/4232)

 解决方案:

按照提示输入命令查看存储库中的大文件

git rev-list --objects --all | grep c91e5de4f55bedd0669db01036fc131ea8e516ce

改写历史,去除大文件

git filter-branch --tree-filter 'rm -f path/to/large/files' --tag-name-filter cat -- --all
git push origin --tags --force
git push origin --all --force

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值