github上传大文件
回归博客时代的第二个星期hhhh。
github单个文件超过50M入库会警告,超过100M会组织入库。因此上传的时候需要用到git-lfs
使用过程
1、首先安装lfs,然后开启lfs功能
Git Bash 输入 git lfs install
2、 切换到你上传文件的文件夹路径:
cd E:github_code/DuetDis
3. 初始化仓库:git init
4. 设置追踪你想要上传的大文件(可以指定多个):
git lfs track "*.npz",这里我追踪的时候总是匹配不上,因此我后来直接指定文件:
git lfs track "xx/xx/xx.npz"
5.上传你的追踪文件
git add .gitattributes
注意如果追踪成功是无信息的,像我之前出现这种,说明没有追踪成功
6.后面就是常见操作了:
git add .
git commit -m "add filxxx"
git push origin master
7.出现上传界面表示成功。恭喜恭喜!
可能遇到问题
1. Failed to connect to github.com port 443: Timed out。可以看看能否网页打开github界面,并且不要忘记关闭自己的翻墙vpn。如果不能打开请参考别人的配置你的host文件,检测一下host是否有问题。
2.Remote “origin” does not support the LFS locking API. Consider disabling it with:
按照提示敲入
$ git config 'lfs.https://github.com/xxx.git/info/lfs.locksver ify' false
3. batch response: Git credentials for https://github.com/xxx.git not found.
error: failed to push some refs to 'https://github.com/xx/big-file.git':
输入:
git config --global credential.helper store
4. OpenSSL SSL_read: Connection was reset, errno 10054
git config --global http.sslVerify "false"
5. 如果像我一样好久未建仓(嗷嗷),遇到问题可以参考:
:remote: Support for password authentication was removed on August 13, 2021.
参考:
配置 Git Large File Storage - GitHub Docs
Failed to connect to github.com port 443: Timed out - 奔跑的痕迹 - 博客园