github上传超过100M的大文件

当上传的工程中有超过100M的文件时,直接上传github会产生如下报错:

remote: error: File retinaface-R50/R50-0000.params is 112.54 MB; 
this exceeds GitHub's file size limit of 100.00 MB
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/XYZ/xxx.git'

解决方法:
安装一个Git LFS(Git Large File Storge,Git 大文件储存)

git lfs install

先把其余文件正常上传,然后跟踪超过100M的文件,

git lfs track retinaface-R50/R50-0000.params # track large file path
git add .gitattributes
git add retinaface-R50/R50-0000.params
git commit -m "submit file"
git push -u origin master

有大文件一起上传push时要先清掉大文件的push缓存:

git filter-branch --force --index-filter "git rm --cached --ignore-unmatch retinaface-R50/R50-0000.params" --prune-empty  --tag-name-filter cat -- --all

出现下面的进度条,就说明文件正在上传中啦~
在这里插入图片描述

你可能感兴趣的:(github)