我目前正在经历将一个大型 Git 项目迁移到 Git-LFS 的过程,其中包括重写整个存储库历史记录以在 Git-LFS 中创建并包含某些文件。这部分过程很好。
然而,我在将新存储库推送到上游远程(GitHub)时遇到了麻烦,因为它似乎太大而无法一次性推送:
PS > git push
Counting objects: 337130, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (73730/73730), done.
remote: fatal: pack exceeds maximum allowed size
fatal: sha1 file '<stdout>' write error: Broken pipe30 MiB/s
error: failed to push some refs to 'git@github.com:my-repo.git'
Run Code Online (Sandbox Code Playgroud)
我尝试使用 HTTPS 得到类似的结果:
PS > git push
Counting objects: 337130, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (73730/73730), done.
error: RPC failed; curl 55 SSL_write() returned SYSCALL, errno = 10053
fatal: The remote end hung up unexpectedly
Writing objects: 100% (337130/337130), 3.58 GiB | 388.62 MiB/s, done.
Total 337130 (delta 261838), reused 337130 (delta 261838)
fatal: The remote end hung up unexpectedly
Everything up-to-date
Run Code Online (Sandbox Code Playgroud)
这似乎有些常见,并且有一些可用的解决方案,包括指定一次上传的提交块。但是我的存储库是镜像克隆,不适用于指定的参考规格:
PS > git push -u origin HEAD~5000:refs/heads/master
error: --mirror can't be combined with refspecs
Run Code Online (Sandbox Code Playgroud)
关于如何将镜像存储库分块推送到远程上游有什么想法吗?
通过在 git 配置中设置为 false 来暂时禁用推送镜像。remote.name.mirror
Push with--mirror
只是推送所有引用(下面的所有内容refs/
),并将存储库配置为推送镜像可以有效地设置--mirror
标志。为了推送一组有限的提交,您需要执行此操作,以便您的 refspec 可以引用足够小的提交集。git push remote refspec
您可能也不想要-u
这里,因为这设置了当前分支的上游,但推送镜像通常根本不使用上游。
(一旦您在远程上有足够的提交,您就可以重新启用推送镜像,因为从那时起,您发送的“薄包”应该更小:实际上很薄,而不仅仅是理论上薄:-)。)
归档时间: |
|
查看次数: |
3488 次 |
最近记录: |