git-rewrite-history - BFG-repo-cleaner 并推送回 GitHub

标签 git-rewrite-history bfg-repo-cleaner

我正在尝试按照此处的教程说明进行操作:https://rtyley.github.io/bfg-repo-cleaner/

我使用 --mirror 克隆了基于 github 的存储库的新副本

我按照说明运行 bgf 和 reflog

我的本​​地存储库现已删除了大博客。太棒了。

当我去推回 github 时,我得到

To github.com:interstar/myproject.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="03646a7743646a776b76612d606c6e" rel="noreferrer noopener nofollow">[email protected]</a>:interstar/myproject.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.

所以我尝试从 github 进行 git pull 以确保同步。 (尽管这个存储库是在流程开始时从 github 干净克隆的)

它会拉下我想要摆脱的所有 Blob 。所以我的存储库恢复到之前的大小。

所以我再次运行 bfg 和 reflog。不错的小仓库。

尝试推回github

同样的错误消息。

我错过了什么?

最佳答案

好的。

我解决了这个问题。这是我自己的愚蠢错误,但留下这个问题以防其他人做同样的事情。

虽然我第一次从 github 克隆存储库时使用了 --mirror,但在某些时候我再次尝试并忘记使用 --mirror 选项。

当我重新使用该选项时,它按照教程的建议工作。

关于git-rewrite-history - BFG-repo-cleaner 并推送回 GitHub,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61900790/

相关文章:

git - 如何替换 git 历史文件中的文本?

git - 自动重写完整的 git 历史以摆脱简单的 merge 提交

git - 从旧的 Git 提交中删除私有(private)信息

java - 使用 BFG Repo Cleaner 删除嵌套文件夹

git - BFG : mapping from old (pre-cleaning) to new hashes

git - 无效的作者/提交者行 - 电子邮件前缺少空格

Git:如何重写远程历史记录?

Git:使用 bfg (beg-repo-cleaner) 删除特定文件

git - 将现有的 Git 存储库迁移到新的支持 Git LFS 的存储库