commit过大文件,导致push失败如何解决
1、查看过大文件是谁
2、使用该命令删除过大文件
git filter-branch –force –index-filter ‘git rm -rf –cached –ignore-unmatch 文件名’ –prune-empty –tag-name-filter cat — –all
例如:
git filter-branch –force –index-filter ‘git rm -rf –cached –ignore-unmatch big-market-front-app_2.0.tar‘ –prune-empty –tag-name-filter cat — –all
3、出现这个报错
Cannot rewrite branches: You have unstaged changes
4、执行该命令
git stash
5、强制推送master分支(也可以是其他分支)
git push origin master –force
6、清空垃圾(防止有残余)
rm -rf .git/refs/original/
git reflog expire –expire=now –all
git gc –prune=now