当前位置:   article > 正文

使用 git push 上传超过100MB文件报错 remote: error: this exceeds GitHub‘s file size limit of 100.00 MB_remote: error: trace:

remote: error: trace:

一、问题描述

使用 git push 将一个 173.86 MB 的文件推送到 GitHub 时出现如下报错

remote: error: Trace: 5c39a1831dc9eced8723579b000596bbbeb91a9069931bbdf49b058aaaf1f64c
remote: error: See https://gh.io/lfs for more information.
remote: error: File linux-zero-4.10.y.zip is 173.86 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
To https://github.com/Gnepuil79/licheepi.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/Gnepuil79/licheepi.git'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

二、解决方法

根据上述的报错信息,我们看出 push 的资源超过100M,我们可以尝试用 Git 大文件存储 (LFS)

PS:Git 大文件存储(Git Large File Storage (LFS))可以简单的理解为存储大文本、视频、数据集的 Git。以下是官网的定义:

Git 大文件存储(LFS)用 Git 中的文本指针替换音频示例、视频、数据集和图形等大文件,同时将文件内容存储在 GitHub.com 或 GitHub Enterprise 等远程服务器上。
  • 1

1、下载 Git-LFS,并安装。下图是安装后的目录
在这里插入图片描述
2、进入安装后的目录,打开 GitBash,执行 git lfs install
这个命令只需执行这一次即可

 git lfs install
  • 1

在这里插入图片描述
3、到仓库目录,打开 GitBash,追踪需要上传的大文件

 git lfs track linux-zero-4.10.y.zip
  • 1

在这里插入图片描述
4、添加要上传的文件属性,(要先添加文件属性,不然有可能会失败)

git add .gitattributes
  • 1

在这里插入图片描述
5、添加属性文件上传的说明

git commit -m "pre"
  • 1

在这里插入图片描述
6、建立本地和 GitHub 仓库的链接(起个别名)

 git remote add origin https://github.com/Gnepuil79/licheepi.git
  • 1

在这里插入图片描述
6、上传属性文件

 git push git@github.com:Gnepuil79/licheepi.git master(或者 git push origin master)
  • 1

在这里插入图片描述
7、添加要上传的大文件

git add -f linux-zero-4.10.y.zip
git commit -m "licheepi linux源码"
git push origin master
  • 1
  • 2
  • 3

在这里插入图片描述
上传成功
在这里插入图片描述


我的qq:2442391036,欢迎交流!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/正经夜光杯/article/detail/884544
推荐阅读
相关标签
  

闽ICP备14008679号