我有一个相当大的 .framework
文件,由于某种原因 Git LFS 不能正常工作,所以我决定忽略它,这样它就不会被推送。
- 我将它添加到我的
.gitignore
中。 我从终端运行了这 3 个命令
git rm -r --cached . git add . git commit -m "fixed untracked files"
我确认不再跟踪
.framework
。当我尝试再次推送提交时,我仍然收到文件太大的错误。
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
我还完全删除了文件,但它仍在尝试推送它。
.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/