向github中上传文件过大超过50M怎么办
2026/6/12 13:43:48 网站建设 项目流程

问题:

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的规则,从而把那些几百兆的大文件剔除出去。

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询