【发布时间】:2022-01-12 23:03:46
【问题描述】:
我在尝试将我的 React 应用程序推送到 Github 时出错。首先,我在 Github 中创建了存储库。然后,我使用git remote add origin <repo name> 添加了远程存储库。然后我添加并提交文件。最后我尝试了git push -u origin main。我收到以下错误:
remote: error: File node_modules/.cache/default-development/0.pack is 153.50 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File node_modules/.cache/default-development/4.pack is 131.01 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File node_modules/.cache/default-development/2.pack is 131.43 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File node_modules/.cache/default-production/0.pack is 131.55 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File node_modules/.cache/default-development/9.pack is 131.12 MB; this exceeds GitHub's file size limit of 100.00 MB
我不明白它是如何超过限制的,因为我过去创建了另外两个具有更多代码的 React 应用程序,并以相同的方式将它们上传到 Github。我能想到的唯一区别是这个项目使用了 Tailwind Css 和 Firebase。如何减小node_modules/.cache/default-development/9.pack 的大小,甚至找到文件是什么?
【问题讨论】:
-
你不应该将
node_modules提交到 Git 中。您只想提交包锁定文件。 stackoverflow.com/q/18128863/2954547。不幸的是,这些大文件现在嵌入在 Git 历史记录中,需要使用 BFG Repo Cleaner 等工具删除。 stackoverflow.com/questions/tagged/bfg-repo-cleaner.