如果 VS Code 代码在尝试推送大文件时挂起,如何阻止 VS Code 代码推送(同步)到 Git?
问题 - 如何阻止 VS Code 尝试推送到 Git,以便我可以将不需要的大文件/文件夹添加到 gitignore,然后再次继续推送?
我升级了 Angular,它在我的项目中创建了一个文件夹,如下图所示,其中有一个名为“.angular”的文件夹。我忘记将其包含在我的 .gitignore 中,并尝试暂存、提交并推送到我的 Git 存储库。 30 分钟后它仍在运行(尝试推送)。
我确实在 git 输出中收到一条消息,指出检测到大文件:
[2022-03-21T06:14:33.091Z]> git push origin master [29424ms] [2022-03-21T06:14:33.091Z]远程:错误:跟踪:47b6ad853b68f1ff7b533b5b9e1e44880272a4bcbf979e9f8afb162aa47ef3a9
远程:错误:请参阅 http://git.io/iEPt8g 了解更多信息。
远程:错误:文件 client/.angular/cache/13.3.0/angular-webpack/5ebe13da59e6342699441237cc06e261c0793966/35.pack 为 113.88 MB;这超出了 GitHub 的文件大小限制 100.00 MB
远程:错误:GH001:检测到大文件。您可能想尝试 Git 大文件存储 - https://git-lfs.github.com。
这是 VS Code 中的选项
QUESTION - How do I stop VS Code from trying to push to Git, so I can add the unneeded large files/folders to gitignore and then proceed to push again?
I upgraded Angular and it created a folder in my project that looks like the image below, with a folder named '.angular'. I forgot to include it in my .gitignore and attempted to stage, commit and push to my Git repo. It's still running (trying to push) 30 minutes later.
I do get a message in the git output that says large file detected:
[2022-03-21T06:14:33.091Z] > git push origin master [29424ms]
[2022-03-21T06:14:33.091Z] remote: error: Trace: 47b6ad853b68f1ff7b533b5b9e1e44880272a4bcbf979e9f8afb162aa47ef3a9
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File client/.angular/cache/13.3.0/angular-webpack/5ebe13da59e6342699441237cc06e261c0793966/35.pack is 113.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.
Here is what options I have in VS Code
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我通过重新加载 VSCode 解决了这个问题,然后将 HEAD~1 重置为之前的提交。
I solved it by reloading VSCode and just git reset HEAD~1 to the previous commit.
我猜您应该解决的真正问题是从该提交中删除大文件。
您可以使用
、git filter-branch
git filter-repo
或bfg
删除大文件夹。如果您恰好刚刚提交了文件(我的意思是最新的提交),您可以使用 git commit --amend 来使最新的提交免于超出限制。
不,现在将其添加到
.gitignore
已经太晚了。现在将其添加到.gitignore
不会将其从 Git 提交历史记录中删除 ->并不能解决突破极限的问题。I guess the real question you should solve is to remove the huge files from that commit.
You can use
,git filter-branch
git filter-repo
orbfg
to remove the large folders.If you happened to commit the file just now (I mean, the newest commit), you can use
git commit --amend
to survive the newest commit from pushing limit.No, it is too late for you to add it to
.gitignore
now. Adding it to.gitignore
now won't remove it from the Git commit history -> won't solve the problem of pushing limit.