向github中上传文件过大超过50M怎么办

问题:

remote: Resolving deltas: 100% (275/275), done. remote: warning: File webkit-2287/WebCore.dll is 52.79 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB remote: error: Trace: eeb285139127d007e043d25ccbfa53a3fa41dc89b1f9b54437e552379716faa7 remote: error: See https://gh.io/lfs for more information. remote: error: File chromium_headless_shell-1223/chrome-headless-shell-win64/chrome-headless-shell.exe is 192.07 MB; this exceeds GitHub's file size limit of 100.00 MB remote: error: File firefox-1522/firefox/xul.dll is 165.92 MB; this exceeds GitHub's file size limit of 100.00 MB remote: error: File chromium-1223/chrome-win64/chrome.dll is 269.88 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 github.com:gototrip1/Automated-resume-submission-Agent.git ! remote rejected master -> master (pre-receive hook declined) error: fai

问题是某个.dll的文件超过了他那个最大文件限制50M,

不安装额外软件(Git LFS) ,只通过修改命令 或者配置来解决这个问题。

报错的核心原因是:你的项目里包含了几个巨大的浏览器内核文件(如 chrome.dll 等),体积超过了 GitHub 的硬性限制(100MB)。

我们要做的就是利用 Git 自带的 .gitignore 功能,把这些"大胖子"文件排除在上传名单之外。

请按照以下步骤操作,这相当于给 Git 下达"黑名单"指令:

1. 创建或编辑 .gitignore 文件

在你的项目根目录(Automated-resume-submission-Agent)下,检查有没有一个叫 .gitignore 的文件。

  • 如果没有 :新建一个文本文件,名字就叫 .gitignore(注意后缀名是空的,不是 .txt)。

  • 如果有:直接用记事本打开它。

2. 写入"黑名单"规则

在文件里写入以下内容,告诉 Git 永远不要追踪这些类型的文件:

复制代码
# 忽略所有 DLL 动态链接库文件(通常是大头)
*.dll
​
# 忽略所有可执行程序文件
*.exe
​
# 如果还有压缩包也忽略掉
*.zip
*.rar
​
# 额外建议:忽略整个浏览器缓存或依赖文件夹(如果存在)
node_modules/
.cache/

写完后保存并关闭。

3. 清除 Git 的"待办清单"(关键步骤)

这一步非常重要!因为 Git 之前已经记住了这些大文件,现在虽然你写了 .gitignore,但它脑子里的清单还没更新。请在 Git Bash 里依次输入这三行命令:

复制代码
# ① 把刚才写的 .gitignore 文件先加进去
git add .gitignore
​
# ② 关键命令:清除所有已缓存的文件(让 Git “忘掉”之前记录的大文件)
git rm -r --cached .
​
# ③ 重新把所有文件(除了被忽略的)加进待办清单
git add .

4. 重新提交并推送

复制代码
# 提交更改
git commit -m "fix: ignore large binary files"
​
# 推送到 GitHub
git push origin master

💡 为什么这样做有效?

  1. .gitignore :相当于给 Git 一张"黑名单",告诉它:"以后看到 .dll.exe 结尾的文件,直接无视,别管它们。"

  2. git rm --cached . :这是最关键的一步。它会把 Git 暂存区里所有文件清空(但不会 删除你电脑上真实的文件),然后 git add . 会重新扫描文件夹。这次扫描会严格遵守 .gitignore 的规则,从而把那些几百兆的大文件剔除出去。

相关推荐
猫咪宝妖14 分钟前
信息安全工程师-网络信息安全
网络
Brilliantwxx17 分钟前
【Linux】 进程(3)深度解析:从查看进程到进程状态
linux·服务器·网络·c++
我星期八休息19 分钟前
Linux—五种IO模型与非阻塞IO
linux·运维·服务器·网络·数据库·网络协议
oooo_z25 分钟前
WebSocket实时行情推送API实战:用iTick搭一个盯盘小工具
网络·websocket·网络协议
CoderJia程序员甲25 分钟前
GitHub 热榜项目 - 周榜(2026-08-22)
ai·大模型·llm·github·ai教程
丰锋ff34 分钟前
Github使用教程
github
leoZ23135 分钟前
10-Git 仓库蒸馏术:从代码仓库到 OpenClaw 虚拟人-蒸馏工具链
大数据·git·深度学习·神经网络·目标检测·elasticsearch·lstm
ShineWinsu42 分钟前
对于 C++:C++20中Concept(概念) 与 Coroutine(协程)的解析
linux·开发语言·网络·c++·c++20·epoll
Loongproxy1 小时前
2026年动态IP代理真实可用率怎么横评?爬虫选代理的关键是什么
服务器·网络·网络协议·tcp/ip
秦渝兴1 小时前
LVS-DR 高可用集群实战:NFS + Web + DNS + Keepalived 全套架构
linux·服务器·网络·lvs