从 Angular 12 升级到 13 后,Github 的缓存太大

S. *_*lor 30 github angular

我最近将 package.json 中的所有依赖项升级到了最新版本。我从 Angular 12.2.0 升级到 13.0.1,github 现在拒绝我的推送,并出现以下文件大小错误。我需要在 angular.json 构建配置文件中定义一些设置来帮助最小化这些缓存文件大小吗?

remote: warning: File .angular/cache/angular-webpack/72163742903fc8ba00e684045de261c2e3a2fb86/3.pack is 54.01 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: warning: File .angular/cache/angular-webpack/72163742903fc8ba00e684045de261c2e3a2fb86/2.pack is 56.42 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: Trace: 0b9557fffbe30aac33f6d9858ef97559341c5c1614ace35524fcba85ac99ca76
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File .angular/cache/angular-webpack/72163742903fc8ba00e684045de261c2e3a2fb86/3.pack is 122.06 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File .angular/cache/angular-webpack/72163742903fc8ba00e684045de261c2e3a2fb86/5.pack is 123.92 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File .angular/cache/angular-webpack/f48e9bc724ec0d5ae9a9d2fed858970d0a503f10/0.pack is 154.05 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File .angular/cache/angular-webpack/9327900b3187f0b6351b4801d208e7b58f1af17e/0.pack is 165.50 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File .angular/cache/angular-webpack/663bcd30d50863949acf1c25f02b95cab85c248a/0.pack is 151.56 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File .angular/cache/angular-webpack/663bcd30d50863949acf1c25f02b95cab85c248a/0.pack is 151.55 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.
Run Code Online (Sandbox Code Playgroud)

编辑:

  1. 我使用 Angular cli 创建了这个存储库,并通过多个版本的 Angular 进行了维护和更新,在最新更新之前没有出现任何问题。

  2. .gitignore 文件位于应用程序的根目录中,与建议的示例匹配: 在此输入图像描述

  3. /.angular/cache添加到 gitignore 文件时,我运行git rm -rf --cached . && git add . && git commit -m 'fix(gitignore): add angular cache' && git push --set-upstream origin chore/bump-deps但仍然出现文件大小错误。

Von*_*onC 35

确保您的文件.gitignore位于的文件夹中.angular
在该.gitignore文件中,一个简单的.angular/cache/内容就足以忽略该子文件夹内容。

检查一下:

git check-ignore -v -- .angular/cache/angular-webpack/72163742903fc8ba00e684045de261c2e3a2fb86/2.pack
Run Code Online (Sandbox Code Playgroud)

ganatan/angular-starter/.gitignore您可以在(来自 Angular 13 示例入门项目)中看到一个示例,其中/.angular/cache/使用 来将规则锚定到存储库的顶部文件夹。

OP S. Taylor在评论中确认:

我很确定那是我的问题。
我放弃了dev分支并更新了我的依赖项,而没有使用诸如git add . && git commit -m 'fix(gitignore): add angular cache'.
确保记下上演的内容。


Nit*_*tsh 6

对我来说,问题仍然存在,

我按照以下方式重新配置了 git:

  1. 复制配置 ( .git/config)
  2. 删除.git文件夹
rm -rf .git
Run Code Online (Sandbox Code Playgroud)
  1. 初始化git
git init 
Run Code Online (Sandbox Code Playgroud)
  1. 将旧配置 (p.1) 粘贴到新的 git 配置文件 ( .git/config)

  2. .gitignore添加行中(更多详细信息:angular-starter/.gitignore):

node_modules
.angular/cache
Run Code Online (Sandbox Code Playgroud)
  1. 添加文件并提交
git add . && git commit -m 'update'
Run Code Online (Sandbox Code Playgroud)
  1. 为了避免覆盖以前的提交,推入新分支
git push -f origin HEAD:<new_branch_name>
Run Code Online (Sandbox Code Playgroud)
  1. 通过覆盖推送(强制导致旧提交丢失),
git push -f origin HEAD:main
Run Code Online (Sandbox Code Playgroud)
  1. 或者
git push -f origin HEAD:master
Run Code Online (Sandbox Code Playgroud)
  1. 一般来说
git push -f origin HEAD:<branch_name>
Run Code Online (Sandbox Code Playgroud)