【git】error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lf
git上传大与100.00MB的文件到github上时报错:
remote: error: GH001: Large files detected. You may want to try Git Large Filetorage - https://git-lfs.github.com.
remote: error: Trace: ~~
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File ~~ is 273.28 MB;his exceeds GitHub's file size limit of 100.00 MB
To https://github.com/~~.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/~~.git'
错误原因:
当单个文件超过100M的时候,push的时候会出现上面的Error。
解决方式:
# 1.安装Git命令行扩展。只需要设置一次Git LFS
$ git lfs install
# 2.选择您希望Git LFS管理的文件类型
$ git lfs track "*.psd"
# 确保跟踪.gitattributes
$ git add .gitattributes
# 3.Just commit and push to GitHub as you normally would.
$ git add file.psd
$ git commit -m "Add design file"
$ git push origin master
注意:如果是提交过程中报错,需要先撤销已提交的commit,再进行如上操作,如果是第一次commit就可以直接用。
# 撤销步骤
# 查看提交记录
$ git log
# 找到提交前的commit,重置
$ git reset xxxxx
但是还是有可能存在
~ username > git push
Uploading LFS objects: 0% (0/1), 2 GB | 104 MB/s, done.
LFS: Put "https://example.com/rest/git-lfs/storage/EXAMPLE/example-repo/d1786cec9c0d23b42e088b57b425f9f9fcfcad53": read tcp 192.168.0.1:1046->192.168.1.1:443: i/o timeout
error: failed to push some refs to 'https://example.com/rest/git-lfs/storage/EXAMPLE/example-repo.git'~ username >
原因
LFS 在等待下一次 TCP 读取或写入时超时。这通常在推送较大的对象或包含多个大对象的大型提交时看到。
解决方案
要解决这个问题,用户需要increase the lfs.activitytimeout value 为他们的 git 客户端解决问题。根据您的客户端版本,最新版本的默认值为 30 秒。在下面的命令中,我们将增加到 60 秒。
git config lfs.activitytimeout 60