清理git commit中的大文件

在git hexo仓库中有一个超过100MB的文件,并且你不小心Commit后,会出现如下报错
remote: Resolving deltas: 100% (405/405), done.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 09c8c1ad5d3478b3692c72197ee5a8c6e76e583e0b76a35add8ac329b445be02
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File 2021/02/28/Excel/one.gif is 488.72 MB; this exceeds GitHub’s file size limit of 100.00 MB

错误中提示2021/02/28/Excel/one.gif文件太大,超过100MB的限制,而无法提交,寻找了一下这个文件,发现已经被删除,但是commit中还是有此文件的提交记录。

安装 git filter-repo

使用pip安装

pip install git-filter-repo

执行清理shared/log/cron.log文件

git filter-repo --invert-paths --path "shared/log/cron.log"

git gc:

git gc --prune=now

删除.deploy_git文件

重新提交

hexo clean
hexo g
hexo d

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值