Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将Git镜像分块推送?_Git_Github - Fatal编程技术网

如何将Git镜像分块推送?

如何将Git镜像分块推送?,git,github,Git,Github,我目前正在经历将一个大型Git项目迁移到Git LFS的过程,其中包括重写整个回购历史,以在Git LFS中创建并包含某些文件。过程的这一部分很好 但是,我在将新存储库推送到上游远程(GitHub)时遇到了问题,因为它似乎太大,无法一次性推送: PS > git push Counting objects: 337130, done. Delta compression using up to 12 threads. Compressing objects: 100% (73730/737

我目前正在经历将一个大型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'
这似乎有些常见,包括指定每次上载的提交块。但是,my repo是镜像克隆,不适用于指定的参照规范:

PS > git push -u origin HEAD~5000:refs/heads/master
error: --mirror can't be combined with refspecs

有没有关于如何将镜像回购分块推送到远程上游的想法?

在git配置中将
remote.name.mirror
设置为false,暂时禁用推送镜像

使用
--mirror
推送只需推送所有引用(在
refs/
下面的所有内容),将存储库配置为推送镜像可以有效地设置
--mirror
标志。为了推送有限的一组提交,您需要执行
git push remote refspec
操作,以便您的refspec可以引用足够小的一组提交

您可能也不希望在此处使用
-u
,因为这会为当前分支设置上游,但推送镜像通常根本不使用上游


(在远程设备上有足够的提交后,您可以重新启用推送镜像,因为从那时起,您发送的“瘦包”应该更小:实际上很薄,而不是理论上很薄:-)

您能告诉我如何临时禁用推送镜像吗?在git配置中将
remote..mirror
设置为false。见人力资源部,好的。我在参考规格方面也有问题。我们大约有1.5万人。你认为哪种简单的方法可以把它分成3或4个推力?很难知道在哪里划分。您可以使用
git rev list--count
来查看从某个起始点可以到达多少个提交,也可以使用一些截止点,例如,
git rev list--count 8765432^22222 3
将告诉您在这两个点之间有多少个提交(在这里,
222…
将是提交,而
876…
是建议的下一批)。但这是提交的数量,而不是对象的数量,更不用说大小。[继续]可能有某种方法可以使用
git pack对象--thin
来构建“测试”打包并检查它的大小,因此自动磨练在一些限制,但我不知道如何立即做到这一点。
PS > git push -u origin HEAD~5000:refs/heads/master
error: --mirror can't be combined with refspecs