【发布时间】:2019-09-20 12:44:45
【问题描述】:
我在我的项目源文件中添加了一个 150MB 的视频,并在不知不觉中提交了它。然后我尝试 git push 提交到我的远程仓库并注意到推送 hung 一段时间,然后最终失败,吐出这个:
Counting objects: 17, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (16/16), done.
Writing objects: 100% (17/17), 145.48 MiB | 138.00 KiB/s, done.
Total 17 (delta 13), reused 0 (delta 0)
remote: Resolving deltas: 100% (13/13), completed with 12 local objects.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 8b4191f1a1055e7dea4412f80b5125d2
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File src/images/greystone_place.mp4 is 145.45 MB; this exceeds GitHub's file size limit of 100.00 MB
我尝试将文件添加到.gitignore,但为时已晚。随后的git push 命令产生了相同的结果。
接下来,我尝试将 HEAD --soft 重置为我最初提交大文件的提交(这是在涉及.gitignore 的更多提交之后)。从那里,我使用git reset HEAD -- path/to/filename 将有问题的文件重置到工作目录并再次提交。这样做,我仍然遇到了同样的错误。
我后来意识到,也许使用--amend 命令可以解决问题(基于this article),但这也不起作用。
我还尝试在软重置时使用git rm --cached path/to/file。这也失败了。
我已经开始阅读有关 git rebase i 和 git filter-branch 的信息,但它们看起来很复杂,我不确定我是否用这种方法找错了树。
我不是 Git 专家,但简而言之,我想对我的其他更改执行 git push 并排除这个大文件。不知何故,它似乎与较早的提交交织在一起,并阻止我向我的远程仓库创建 push。
【问题讨论】:
标签: git