会提示remote: error: GH001: Large files detected. You may want to try Git Large File Storage
在push时会出现类似这样的信息,github最大支持单个文件是100M
yunwei@YunweideMacBook-Pro python % git push --set-upstream master master
Enumerating objects: 39, done.
Counting objects: 100% (39/39), done.
Delta compression using up to 8 threads
Compressing objects: 100% (34/34), done.
Writing objects: 100% (39/39), 16.71 MiB | 735.00 KiB/s, done.
Total 39 (delta 7), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (7/7), done.
remote: error: Trace: 4a078d9c224b9714af570c547b1d606bf7415c2738c7009b9007aed6333d60dc
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File test/logfile/all.log is 285.66 MB; 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.
To https://github.com/xxxx/python.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/xxxx/python.git'
yunwei@YunweideMacBook-Pro python %
解决办法之一是将这个文件从版本库中删除
yunwei@YunweideMacBook-Pro python % git filter-branch --force --index-filter "git rm -rf --cached --ignore-unmatch test/logfile/all.log" --prune-empty --tag-name-filter cat -- --all
WARNING: 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 d1f0bffcc7e9b05087633598857a26fa63956a64 (2/5) (0 seconds passed, remaining 0 predicted) rm 'test/logfile/all.log'
Rewrite 84cd4c754640579dbf3769ee2322d179b5e77cb3 (5/5) (0 seconds passed, remaining 0 predicted)
Ref 'refs/heads/master' was rewritten
yunwei@YunweideMacBook-Pro python %
然后再次push就ok了