Git error, need to remove large file

前端 未结 8 574
北恋
北恋 2021-02-01 05:37

I am getting this error when I try to push to git and I have no idea how to fix it.

Counting objects: 1239, done.
Delta compression using up to 4 threads.
Compre         


        
8条回答
  •  有刺的猬
    2021-02-01 06:10

    To improve upon one of the reply above, you need

    git filter-branch -f --tree-filter 'rm -f /path/to/file' HEAD --all
    

    in order to remove your file even from the history. You need -f to force rewriting any backup and --all to remove file from all branches. More information here: Git docs

    Your large file error won't go away by removing it from the git cache because it is still lurking in the commit history.

提交回复
热议问题