commit过大文件,导致push失败如何解决

作者 : admin 本文共485个字,预计阅读时间需要2分钟 发布时间: 2024-06-12 共1人阅读

1、查看过大文件是谁

commit过大文件,导致push失败如何解决插图

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

 

本站无任何商业行为
个人在线分享 » commit过大文件,导致push失败如何解决
E-->