Git 仍在尝试推送被忽略和删除的文件

标签 git github

我有一个相当大的 .framework 文件,由于某种原因 Git LFS 不能正常工作,所以我决定忽略它,这样它就不会被推送。

  1. 我将它添加到我的 .gitignore 中。
  2. 我从终端运行了这 3 个命令

    git rm -r --cached .
    git add .
    git commit -m "fixed untracked files"
    
  3. 我确认不再跟踪 .framework

  4. 当我尝试再次推送提交时,我仍然收到文件太大的错误。

    remote: error: GH001: Large files detected. You may want to try Git Large 
    File Storage - https://git-lfs.github.com.
    remote: error: Trace: 6b97634aa8b5de75e8affdcb19d13b98
    remote: error: See http://git.io/iEPt8g for more information.
    remote: error: File path/to/My.framework/Versions/A/My is 101.13 MB;
    this exceeds GitHub's file size limit of 100.00 MB
    
  5. 我还完全删除了文件,但它仍在尝试推送它。

.framework 并不总是那么大。它最近才变得 >100MB,所以过去推送没有问题。这里有什么解决办法吗?

最佳答案

当您推送时,您不仅仅是在推送一个提交,而是在推送远程尚未拥有的所有提交。我想你做了这样的事情。

1. Push/pull to be in sync with the remote.
2. Commit the large file.
3. Delete the large file.
4. Push.

现在您正在推送添加大文件的提交和删除大文件的提交。它们必须被 push 。

您可以使用 git log --stat origin/master 检查将要推送的内容(假设远程是 origin 并且分支是 master)。特别是,提交 6b97634aa8b5de75e8affdcb19d13b98 将是问题所在。

如果是这种情况,您将不得不 delete the large file from history .

但考虑到您在 git-lfs 推送方面遇到问题,我认为这里还有其他问题。我怀疑您丢失了另一个 大文件。也许您可以展示您的实际存储库?

关于Git 仍在尝试推送被忽略和删除的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33466466/

相关文章:

git - 如何从暂存区中删除单个文件(撤消 git add)?

python - Azure函数使用ssh访问私有(private)github存储库

github - 如何在 GITHUB 中隐藏提交

python - 随机采样 Github 存储库

git - github网站是如何工作的(架构)?

git - 在 Github 包注册表中绑定(bind) Docker 镜像以更正 Github 提交

javascript - 在 A 依赖于 B、B 依赖于 C 的情况下,并行处理 A、B 和 C 的完美工作流程是什么?

Git GPG 错误签名标签

git - 是否可以在 .gitconfig 中包含一个文件

node.js - NPM - Fork 模块,更改代码并将 PR 发送给作者