首页 > 解决方案 > 文件太大,添加到 git ignore 但仍在尝试添加

问题描述

我收到此错误

远程:错误:文件 _____ 为 262.63 MB;这超出了 GitHub 的文件大小限制 100.00 MB

所以我将文件添加到.gitignore。

但是它仍在尝试添加它。我需要做些什么才能让它工作吗?

标签: git

解决方案


它可能仍被添加到您的 git 存储库中,因此您需要使用以下命令将其删除:

git rm --cached path/to/giant_file
# Stage your giant file for removal from the git repo

使用 --amend 提交此更改

git commit --amend -CHEAD
# Amend the previous commit with your change

最后,您可以像往常一样推送!

git push
# Push your smaller commit

推荐阅读