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

上传成功

目录
相关文章
|
2月前
|
算法 安全 网络安全
git clone操作报错diffie-hellman-group1-sha1的解决方案
在处理这一问题时,需要确保了解相关操作的安全影响。`diffie-hellman-group1-sha1`算法被认为是不够安全的,这是因为随着计算能力的提高,`SHA-1`算法可以在合理的时间内被破解,而且其对应的 `1024位`Diffie-Hellman组也可能不够强大。因此,在确保Git操作的同时,也要考虑提升安全性的长期解决办法。强烈推荐与管理员或相关技术支持团队合作,升级和加强服务器端的安全配置。
91 12
|
5月前
|
Shell 开发工具 git
解决git bash报错:在仓库中检测到可疑的所有权
总的来说,解决“在仓库中检测到可疑的所有权”的报错,关键在于理解和调整文件或目录的所有权。只要我们正确地设置了文件或目录的所有权,那么我们就可以避免这种问题,让Git Bash正常工作。
215 22
|
5月前
|
人工智能 API 开发工具
GitHub官方开源MCP服务!GitHub MCP Server:无缝集成GitHub API,实现Git流程完全自动化
GitHub MCP Server是基于Model Context Protocol的服务器工具,提供与GitHub API的无缝集成,支持自动化处理问题、Pull Request和仓库管理等功能。
1111 2
GitHub官方开源MCP服务!GitHub MCP Server:无缝集成GitHub API,实现Git流程完全自动化
|
3月前
|
网络协议 开发工具 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” 的报错。这个问题通常是由网络连接问题或代理设置不正确导致的。在我的个人使用经验中,我亲自尝试了四种方法,它们都能够有效地解决这个报错。个人比较推荐方法二。
1767 0
|
6月前
|
开发工具 git 索引
warning: You ran ‘git add’ with neither ‘-A (—all)’ or ‘—ignore-removal’,报错如何解决 git报错 ‘git add —ignore-removal <pathspec>优雅草卓伊凡
warning: You ran ‘git add’ with neither ‘-A (—all)’ or ‘—ignore-removal’,报错如何解决 git报错 ‘git add —ignore-removal <pathspec>优雅草卓伊凡
101 21
warning: You ran ‘git add’ with neither ‘-A (—all)’ or ‘—ignore-removal’,报错如何解决 git报错 ‘git add —ignore-removal <pathspec>优雅草卓伊凡
|
5月前
|
文字识别 网络协议 开发工具
GitHub封锁?推荐5个国产的Git仓库替代平台
近日,GitHub对中国区IP的部分限制引发了广泛关注。未登录用户被拒,已登录用户功能受限,南北网络环境差异更显“内卷”。为应对这一挑战,本文推荐了多个国产Git平台:Gitee(码云)、GitCode(CSDN旗下)、CODING(腾讯系)、CodeUP(阿里云支持)及微信代码管理工具。这些平台功能全面、稳定性强,是开发者迁移项目的理想选择。通过同步代码、配置CI/CD流水线等简单步骤,可确保项目平稳过渡。此次事件提醒我们,掌握核心技能与支持国产平台同样重要!
2879 11
|
7月前
|
开发工具 git
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
625 3
git 使用之remote: File [4e21e71a555febaa4dfaaa05cf7eeb606ea96ae2] size 104.090MB, exceeds quota 100MB remote: Please remove the file[s] from history and try again 报错如何解决-优雅草卓伊凡
|
开发工具 git
git删除远程remote分支
git 命令如下: git push origin --delete
1590 0
|
3月前
|
安全 开发工具 git
git的常用操作命令
git的常用操作命令
295 57
|
4月前
|
存储 项目管理 开发工具
Git常用命令及操作技巧
以上是Git的常用命令及操作技巧,尽管看起来有些繁琐,但实际上只要花费一些时间进行实践,您将很快熟练掌握。随着使用熟练度的提高,您会发现Git对项目管理和协同工作的强大帮助。
128 20