Git 提交记录包含大文件导致push失败

push报错提示:

 1.根据上图提示,使用git命令:

$ git rev-list --objects --all | grep 779553bb45cd0b2911c6d53e62efa4298b62c08f
779553bb45cd0b2911c6d53e62efa4298b62c08f cloud-api-common/src/test/java/com/ckq/demo/soft/otp_win64_25.0.4.exe

2.删除大文件

$ git filter-branch --force --index-filter 'git rm -rf --cached --ignore-unmatch cloud-api-common/src/test/java/com/ckq/demo/soft/otp_win64_25.0.4.exe' --prune-empty --tag-name-filter cat -- --all
WARNING: git-filter-branch has a glut of gotchas generating mangled history
         rewrites.  Hit Ctrl-C before proceeding to abort, then use an
         alternative filtering tool such as 'git filter-repo'
         (https://github.com/newren/git-filter-repo/) instead.  See the
         filter-branch manual page for more details; to squelch this warning,
         set FILTER_BRANCH_SQUELCH_WARNING=1.
Proceeding with filter-branch...

Rewrite 72970ad27a9de455f353f62cbd908c45666d2834 (23/48) (67 seconds passed, remaining 72 predicted)    rm 'cloud-api-common/src/test/java/com/ckq/demo/soft/otp_win64_25.0.4.exe'
Rewrite 1a6718eb05677ca1fa71cf1074a60edc642484a4 (24/48) (72 seconds passed, remaining 72 predicted)    rm 'cloud-api-common/src/test/java/com/ckq/demo/soft/otp_win64_25.0.4.exe'
Rewrite 645f78347093f7d71f296ac695eeaf4545476f85 (25/48) (73 seconds passed, remaining 67 predicted)    rm 'cloud-api-common/src/test/java/com/ckq/demo/soft/otp_win64_25.0.4.exe'
Rewrite 7ba518f712d5ce2549868ef88902d100b589468e (48/48) (143 seconds passed, remaining 0 predicted)
Ref 'refs/heads/master' was rewritten
Ref 'refs/remotes/origin/master' was rewritten

3.强制push

$ git push origin master --force

4.清理

rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值