代码之家  ›  专栏  ›  技术社区  ›  Joe Scotto

使用bfg清除文件后无法推送到>2gb回购

  •  0
  • Joe Scotto  · 技术社区  · 6 年前

    我不小心把一些本应被忽略的大文件推送到git,结果我的repo超过了2gb。我试图用bfg清除一些文件,并且已经能够清除大约400mb的文件,但是当尝试推送时,我得到以下错误

    Counting objects: 1510, done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (621/621), done.
    Writing objects: 100% (1510/1510), 373.84 MiB | 11.69 MiB/s, done.
    Total 1510 (delta 879), reused 1403 (delta 778)
    remote: Resolving deltas: 100% (879/879), completed with 95 local objects.
    remote: repository is in read only mode (over 2 GB size limit).
    remote:
    remote: Learn how to reduce your repository size: https://confluence.atlassian.com/x/xgMvEw.
    To https://bitbucket.org/HIDDEN/REPO.git
     ! [remote rejected]   feature/feature -> feature/wikitude (pre-receive hook declined)
    error: failed to push some refs to 'https://bitbucket.org/HIDDEN/REPO.git'
    

    我在网上读到,武力推动可以解决这个问题,但我觉得这可能有风险,我确实有一个后援 --mirror 在我和bfg删除文件之前。

    2 回复  |  直到 6 年前
        1
  •  0
  •   Code-Apprentice    6 年前

    通过删除文件,您创建了新的提交和一个全新的历史记录,而不是远程repo对分支的历史记录。你必须使用 git push -f 为了迫使你改变。

    这里的风险是,如果其他人已经提取了您的更改,他们将需要做一些工作来清理他们回购协议中的大文件。如果只有你在做这个项目,那你就不必担心了。

        2
  •  0
  •   Joe Scotto    6 年前

    在允许我推之前,必须先伸手去Bitbucket清理回购协议。