如何阻止 Git 尝试推送不存在的文件



尝试push时,我收到一个致命错误,因为 git 试图包含一个对于 GitHub 来说太大的文件。 git rm file失败是因为文件不存在(它已存在,但不再存在)。Git 似乎拒绝承认文件已消失。

我该怎么办?


有关信息,我收到的错误消息是:

remote: error: GH001: Large files detected.
remote: error: Trace: dbbfb79f51f133c90dfd58730a4ab624
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File [filename] is 385.65 MB; this exceeds GitHub's file size limit of 100 MB
To https://github.com/[---].git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/[---].git'

如果上述内容看起来不可能实现,那么有关如何在此处烧毁所有与 git 相关内容并使用我们保存在备份目录中的代码从头开始设置它的说明会很棒。我们真的没有时间再乱搞 git 了......

即使

文件不再存在,也要运行git rm --cached file。这样,文件将从索引中删除。

如果您希望从 Git 历史记录中完全消除该文件,则需要一些 git filter-branch -fu。

最新更新