Git仍然试图推送被忽略和删除的文件

时间:2015-11-01 19:49:44

标签: 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. 我也完全删除了文件,但仍在尝试推送它。

  6. .framework并不总是那么大。它最近才变成> 100MB,所以它过去没有问题。这里有解决方案吗?

1 个答案:

答案 0 :(得分:0)

当你推送时,你不只是推送一个提交,你正在推动遥控器还没有的所有提交。我认为你做过这样的事情。

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

现在你要推送添加大文件的提交和删除它的提交。 这两个必须被推送。

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

如果是这种情况,则必须delete the large file from history

但鉴于您在两个 git-lfs 推送时遇到问题,我认为此处还有其他问题。我怀疑你错过了另一个大文件。也许您可以展示您的实际存储库?

相关问题