问题:
在GitHub上传超过100MB文件时会触发以下错误:
this exceeds GitHub's file size limit of 100.00 MB
原因:
这是GitHub官方对repo设的限制。
解决方法:
GitHub官方提供了一个叫lfs的工具来解决这个问题。解决步骤如下:
- 安装lfs,官方安装教程: https://github.com/git-lfs/git-lfs/wiki/Installation
这里给出ubuntu上的安装步骤
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
git lfs install
注: 其中git lfs install在要提交大文件的git工程中执行。
成功时的输出(test是一个测试工程,已经init过):
eraul@eraul:~/tmp/test$ git lfs install
Updated git hooks.
Git LFS initialized.
在工程中会多一个.gitattributes的文件夹
- 找到工程中的所有大文件
eraul@eraul:~/rkSource/rknn-toolkit$ find ./ -size +100M
./test/xxx1.whl
./test/xxx2.whl
./test/xxx3.whl
将这些大文件加到lfs track列表中
git lfs track ./test/xxx1.whl
git lfs track ./test/xxx2.whl
git lfs track ./test/xxx3.whl
- 添加这些大文件
git add .
- 提交
git commit -m "Add some files which size is bigger than 100.00 MB"
- 将提交同步到github服务器
git push