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
参考文章:【1】Git Large File Storage
【2】Github超过100M的大文件上传
【3】github push文件过大如何解决?