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

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

一、问题描述


使用 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'


二、解决方法


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


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

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

1、下载 Git-LFS,并安装。下图是安装后的目录

2、进入安装后的目录,打开 GitBash,执行 git lfs install

这个命令只需执行这一次即可

git lfs install

3、到仓库目录,打开 GitBash,追踪需要上传的大文件

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

4、添加要上传的文件属性,(要先添加文件属性,不然有可能会失败)

git add .gitattributes

5、添加属性文件上传的说明

git commit -m "pre"

6、建立本地和 GitHub 仓库的链接(起个别名)

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

6、上传属性文件

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

7、添加要上传的大文件

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

上传成功

目录
相关文章
|
6月前
|
安全 开发工具 git
git添加远程仓库报错To add an exception for this directory解决方案-优雅草卓伊凡
git添加远程仓库报错To add an exception for this directory解决方案-优雅草卓伊凡
700 5
git添加远程仓库报错To add an exception for this directory解决方案-优雅草卓伊凡
|
9月前
|
算法 安全 网络安全
git clone操作报错diffie-hellman-group1-sha1的解决方案
在处理这一问题时,需要确保了解相关操作的安全影响。`diffie-hellman-group1-sha1`算法被认为是不够安全的,这是因为随着计算能力的提高,`SHA-1`算法可以在合理的时间内被破解,而且其对应的 `1024位`Diffie-Hellman组也可能不够强大。因此,在确保Git操作的同时,也要考虑提升安全性的长期解决办法。强烈推荐与管理员或相关技术支持团队合作,升级和加强服务器端的安全配置。
236 12
|
10月前
|
网络协议 开发工具 git
解决 git 报错 “fatal: unable to access ‘https://github.com/.../.git‘: Recv failure Connection was rese
在使用 Git/Git小乌龟 进行代码管理的过程中,经常会遇到各种各样的问题,其中之一就是在执行 git clone 或 git pull 等操作时出现 “fatal: unable to access ‘https://github.com/…/.git’: Recv failure Connection was reset” 的报错。这个问题通常是由网络连接问题或代理设置不正确导致的。在我的个人使用经验中,我亲自尝试了四种方法,它们都能够有效地解决这个报错。个人比较推荐方法二。
7010 1
|
Shell 开发工具 git
解决git bash报错:在仓库中检测到可疑的所有权
总的来说,解决“在仓库中检测到可疑的所有权”的报错,关键在于理解和调整文件或目录的所有权。只要我们正确地设置了文件或目录的所有权,那么我们就可以避免这种问题,让Git Bash正常工作。
547 22
|
开发工具 git
git push报错:The current branch master has no upstream branch
git push报错:The current branch master has no upstream branch
40878 0
git push报错:The current branch master has no upstream branch
|
项目管理 开发工具 git
git push 报错 pre-receive hook declined
git push 报错 pre-receive hook declined
5798 0
git push 报错 pre-receive hook declined
|
开发工具 git
完美解决git 执行git push origin master指令 报错command not found
完美解决git 执行git push origin master指令 报错command not found
739 0
|
开发工具 git
git push origin master提交报错解决办法
git push origin master提交报错解决办法
815 0
|
开发工具 git
【Git】 git push origin master Everything up-to-date报错
【Git】 git push origin master Everything up-to-date报错
310 0
|
开发工具 git
【Git】push代码时候报错,出现fatal: unable to access xxx Recv failure: Connection was reset
【Git】push代码时候报错,出现fatal: unable to access xxx Recv failure: Connection was reset
890 0
下一篇
开通oss服务