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

 

相关推荐

  1. git 提交文件 解决办法

    2024-06-15 21:08:04       52 阅读
  2. 处理导入Excel文件导致Zip bomb detected的问题

    2024-06-15 21:08:04       28 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-06-15 21:08:04       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-06-15 21:08:04       101 阅读
  3. 在Django里面运行非项目文件

    2024-06-15 21:08:04       82 阅读
  4. Python语言-面向对象

    2024-06-15 21:08:04       91 阅读

热门阅读

  1. 如何为微信小程序添加人脸识别和身份验证功能

    2024-06-15 21:08:04       35 阅读
  2. C++day4

    C++day4

    2024-06-15 21:08:04      28 阅读
  3. elasticsearch结构化搜索

    2024-06-15 21:08:04       36 阅读
  4. Windows环境下JDK安装及环境变量配置指南

    2024-06-15 21:08:04       31 阅读