git上传文件过大会出现以下问题:
remote: Resolving deltas: 100% (13/13), completed with 1 local object.
remote: warning: File reference/IEEE slam 2020/bulk-download (9).zip is 63.66 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 1701297b460ffbac13931d2138066183f42e1597d502b20d31df2fd5819f569e
remote: error: See http://git.io/iEPt8g for more information.
使用网上教程的时候,由于不熟悉,容易踩坑,之前一直尝试没成功过,今天终于成功了,记录一下。
正确的步骤是:
git lfs install
git lfs track "your_large_file"
git add .gitattributes
git add your_large_file
git commit -m "Add large file"
git push origin master
注意事项
1.大文件路径中的特殊符号处理
首先,因为大文件中含有括号和空格,出现了以下错误,导致第一次尝试lfs大文件工具使用失败,因此解决这个问题非常关键。
bash: syntax error near unexpected token `('
所以在使用git lfs track这个指令的时候,一定要带""双引号,否则极易出错,而且还不知道原因在哪。
2.gitattributes添加之后,使用git add能利用tab键自动查找到large file,否则证明添加大文件路径时出错
在使用git lfs track "your_large_file"指令的时候,要带路径!!带文件路径!!不能只是文件名,否则会出错!!