代码之家  ›  专栏  ›  技术社区  ›  Zulhilmi Zainudin

如何从旧Git提交中删除大文件?

  •  0
  • Zulhilmi Zainudin  · 技术社区  · 6 年前

    我正在使用以下脚本将回购从BitBucket迁移到GitHub:

    git clone --mirror git@bitbucket.org:my-username/my-project.git my-project
    cd my-project
    git remote remove origin
    hub create --private my-username/my-project
    git remote add origin git@github.com:my-username/my-project.git
    git branch --set-upstream-to origin/master
    git push --all --follow-tags
    

    注: hub

    上面脚本的最后一个命令给了我这个错误:

    Enumerating objects: 74049, done.
    Counting objects: 100% (74049/74049), done.
    Delta compression using up to 4 threads
    Compressing objects: 100% (16940/16940), done.
    Writing objects: 100% (74049/74049), 191.91 MiB | 2.22 MiB/s, done.
    Total 74049 (delta 56351), reused 74047 (delta 56351)
    remote: Resolving deltas: 100% (56351/56351), done.
    remote: warning: File dsf_calculations_28th_july.csv is 69.58 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
    remote: warning: File dsf_calculations_28th_july.csv is 66.19 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
    remote: warning: File latest.dump.2 is 52.05 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
    remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
    remote: error: Trace: 466e8ca5e957b77cb35f49d1a94a040b
    remote: error: See http://git.io/iEPt8g for more information.
    remote: error: File test_18490 is 417.38 MB; this exceeds GitHub's file size limit of 100.00 MB
    

    当我 cd 在本地计算机的克隆存储库中,我找不到 试验室18490 文件。我想这个文件很久以前在一个旧的Git提交中被推送到了BitBucket,我不知道提交散列。

    问题

    1. 如果我删除 文件,它是否也会更改/删除提交?
    2. 文件删除是否重写具有 文件和存储库中的最后一次提交?
    0 回复  |  直到 6 年前