git提交超过文件限制的解决办法
git提交超过文件限制的解决办法
问题
1 |
|
报错信息中第三行提示文件太大
解决方法
- 查看是哪个文件超过限制
- 第二行
remote: error: File new-nsita/bitmap/bitmap.pdf is 189.85 MB; this exceeds GitHub's file size limit of 100.00 MB
说明是bitmap.pdf
这个文件太大,超过了100M的限制。所以我们就要处理这个文件了
- 第二行
- 重写commit,删除大文件
git filter-branch --force --index-filter 'git rm -rf --cached --ignore-unmatch new-nsita/bitmap/bitmap.pdf' --prune-empty --tag-name-filter cat -- --all
注意将new-nsita/bitmap/bitmap.pdf
替换成你的路径与文件看到第8行提示重写 说明成功1
2
3
4
5
6
7
8
9
10
11
12WARNING: 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 2621a6906cd6cf828ccf659622c8959c98e6eaab (3/5) (1 seconds passed, remaining 0 predicted) rm 'new-nsita/bitmap/bitmap.pdf'
WARNING: Ref 'refs/heads/master' is unchanged
Ref 'refs/heads/xxx' was rewritten
WARNING: Ref 'refs/remotes/origin/master' is unchanged
WARNING: Ref 'refs/stash' is unchanged
- 强制推送修改后的repo
git push origin xxx --force
xxx是你当前的分支名- 可以看到成功推送
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!