git 上传大文件失败,提示remote: error: GH001: Large files detected. You may want to try Git Large File Storage

commit 时提示错误信息

Writing objects: 100% (231/231), 112.31 MiB | 18.65 MiB/s, done.
Total 231 (delta 84), reused 0 (delta 0)
remote: Resolving deltas: 100% (84/84), completed with 12 local objects.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https:
//git-lfs.github.com.
remote: error: Trace: aceec14efab075cbc61e63de
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File out/artifacts/maomao_jar/maomao.jar is 124.31 MB; this exceeds GitHub's file size limit of 100.00 MB

这就是不小心本地提交了大文件,无法提交到github了。
但是可能本地很有很多次 commit ,没办法回滚,这就需要把这个文件关联的所有commit进行修改了。
找到指定的太大的那个文件 out/artifacts/maomao_jar/maomao.jar ,然后对这个文件进行清理。

git filter-branch --force --index-filter "git rm -rf --cached --ignore-unmatch out/artifacts/maomao_jar/maomao.jar" --prune-empty --tag-name-filter cat -- --all

然后静静等待对所有涉及的commit进行修改,过程如下

G:\0NewIdea\miaomiao>git filter-branch --force --index-filter "git rm -rf --cached --ignore-unmatch out/artifacts/
maomao_jar/maomao.jar" --prune-empty --tag-name-filter cat -- --all
Rewrite f32ff7fafdd6281d1ebc63386623e652f61306ba (22/33) (23 seconds passed, remaining 11 predicted)    rm 'out/ar
tifacts/maomao_jar/maomao.jar'
Rewrite b49d1a2d3c06ddcb6dbbee565f0db2941cec995e (23/33) (24 seconds passed, remaining 10 predicted)    rm 'out/ar
tifacts/maomao_jar/maomao.jar'

最后执行正常的 push即可。

原文链接:https://blog.csdn.net/weixin_43680337/article/details/119059737

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值