2025年4月7日 星期一

GitHub this exceeds GitHub's file size limit of 100.00 MB use git filter-branch --force --index-filter git-filter-repo

 GitHub this exceeds GitHub's file size limit of 100.00 MB

當repo檔案過大時(超過100MB),push至github出現


this exceeds GitHub's file size limit of 100.00 MB

remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.



可以使用 把某大檔案從原本的commit清除,或是有commit到比較敏感的文件也可以用這個方式處理。


git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch src/conf/*.BIN' --prune-empty --tag-name-filter cat -- --all


不過這個 command 當repo過大時執行會很耗時,執行幾次再push 居然還有出現沒有rewrite的commit 


可以改用 git-filter-repo

sudo snap install git-filter-repo


git filter-repo --force --path-glob 'src/conf/*.BIN' --invert-paths


原本執行800s+的repo 只好耗費 

Completely finished after 45.13 seconds.

沒有留言:

張貼留言