无法将大型存储库从 gitlab 迁移到 github

Can't migrate large repo from gitlab to github

我正在尝试将私有存储库从 Gitlab 迁移到 Github。它包含一些使用 git LFS 跟踪的大文件。即使在那之后,我也无法将回购推送到 GitHub。存储库的大小很大,因为它是操作系统的完整代码库,存储库的大小约为 75GB。

当我尝试将其推送到 GitHub 时,我收到以下日志。

Uploading LFS objects: 100% (8600/8600), 5.9 GB | 0 B/s, done
Enumerating objects: 472049, done.
Counting objects: 100% (472049/472049), done.
Compressing objects: 100% (302043/302043), done.
kex protocol error: type 7 seq 16549), 1020.66 MiB | 4.88 MiB/s
kex protocol error: type 7 seq 32979), 1.99 GiB | 4.83 MiB/s
remote: fatal: pack exceeds maximum allowed size
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly

如果有任何方法可以绕过大小限制,请告诉我。

GitHub 不允许单次推送超过 2 GB 以防止某些类型的 DoS 攻击。除非您使用 GitHub 导入实用程序,否则您需要逐步推送此存储库。

你可以通过 运行 这样的方式来做到这一点:

git rev-list --reverse --all | ruby -ne 'x ||=0; x += 1; print $_ if x % 30000 == 0;' | xargs -I{} echo git push github +{}:refs/heads/master
git push github +master
git push --mirror github

这会一次推送 30000 次提交。一旦这些都被推送,它最后一次推送 master 分支以包含正确的数据,然后镜像存储库的其余部分。