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即可。

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐