我们有一个远程git存储库,其中没有文件的大小限制,我们已经推入了300MB。然后我们实现了它,然后从存储库中删除了该文件。
同时将相同的存储库添加到github,当我们尝试将更改推送到github时,我们得到大文件大小错误。
remote: error: File dir/filename is 312.27 MB; this exceeds GitHub's file size limit of 100 MB
要解决此问题,我尝试使用How to remove/delete a large file from commit history in Git repository?建议的交互式git rebase解决方案,但在rebase操作结束时,当我执行 git status <时,我会得到以下结果/ p>
[18:10:35] $ git status
On branch master
Your branch and 'origin/master' have diverged,
and have 8 and 24 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
如果我使用 git pull ,那么我删除的所有更改都会被带回git存储库。我该如何解决这个问题?
答案 0 :(得分:2)
如果我找到了你的权利,在变基之后你想要git push -f origin
而不是git pull
。这会按预期重写远程存储库历史记录。
注意强制推送到共享存储库可能会消除其他人的更改,并且只应在与有权访问的所有人进行协商后才能完成。
此外,我建议您确保将来可以访问丢弃的origin/master
历史记录(通过标记它或类似的东西),至少在每个人都同意该变化很好的情况下。