Clean up large files in git commit

There is a file exceeding 100MB in the git hexo warehouse, and after you accidentally Commit, the following error will appear
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

The error prompts that the 2021/02/28/Excel/one.giffile is too large, exceeding the limit of 100MB, and cannot be submitted. I searched for this file and found that it has been deleted, but there is still a submission record of this file in the commit.

Install git filter-repo

Install using pip

pip install git-filter-repo

Perform cleanup of shared/log/cron.log file

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

git gc:

git gc --prune=now

Delete the .deploy_git file

Resubmit

hexo clean
hexo g
hexo d

Guess you like

Origin blog.csdn.net/zy440458/article/details/114336712