如何将Git镜像逐块推入? [英] How do I push a Git mirror in chunks?
问题描述
我目前正在将一个大型Git项目移至Git-LFS,其中包括重写整个回购历史记录,以在Git-LFS中制作并包含某些文件.该过程的这一部分很好.
但是我在将新存储库推送到上游远程站点(GitHub)时遇到了麻烦,因为它看起来太大了,无法一口气推送:
PS>git推计数对象:337130,已完成.增量压缩最多使用12个线程.压缩对象:100%(73730/73730),已完成.远程:致命:装箱超过允许的最大尺寸致命的:sha1文件'< stdout>'写入错误:管道损坏30 MiB/s错误:无法将一些引用推送到'git@github.com:my-repo.git'
我尝试使用HTTPS获得类似结果:
PS>git推计数对象:337130,已完成.增量压缩最多使用12个线程.压缩对象:100%(73730/73730),已完成.错误:RPC失败;curl 55 SSL_write()返回SYSCALL,errno = 10053致命:远端意外挂断书写对象:100%(337130/337130),3.58 GiB |388.62 MiB/s,已完成.总计337130(增量261838),已重用337130(增量261838)致命:远端意外挂断一切都是最新的
这似乎很常见,并且有一些可用的解决方案包括指定一次上传的提交块.但是,我的仓库是镜像克隆,不适用于指定的refspecs:
PS>git push -u源头HEAD〜5000:refs/heads/master错误:-mirror不能与refspecs结合使用
关于如何将镜像存储库分批推送到远程上游的任何想法吗?
通过在git配置中将 remote. name .mirror
设置为false,暂时禁用推送镜像./p>使用-mirror
进行
Push只需推送所有ref( refs/
下的所有内容),并将存储库配置为即可有效设置推送镜像-mirror
标志.为了推送一组有限的提交,您需要执行 git push remote refspec
足够少的提交集.
您可能也不想在这里使用 -u
,因为这会设置当前分支的上游,但是推送镜像通常根本不使用上游.
(一旦遥控器上有足够的提交,就可以重新启用推送镜像,因为从那以后,您发送的瘦包"应该更小:实际上很薄,而不是理论上很薄的:-))
I'm currently going through the process of moving a large Git project to Git-LFS, which includes rewriting the entire repo history to make and include certain files within Git-LFS. This part of the process is fine.
However I am having trouble pushing the new repository to an upstream remote (GitHub) as it appears it is too big to push in one go:
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'
I tried using HTTPS with similar results:
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
This appears to be somewhat common and there are some solutions available including specifying chunks of commits to upload at a time. However my repo is a mirror clone and does not work with specified refspecs:
PS > git push -u origin HEAD~5000:refs/heads/master
error: --mirror can't be combined with refspecs
Any ideas on how I can push a mirrored repo to a remote upstream in chunks?
Temporarily disable push mirroring by setting remote.name.mirror
to false in the git config.
Push with --mirror
simply pushes all refs (everything underneath refs/
), and configuring the repository as a push mirror effectively sets the --mirror
flag. In order to push a limited set of commits, you need to do the git push remote refspec
thing, so that your refspec can refer to a sufficiently-small set of commits.
You probably don't want -u
here either, as that sets the upstream for the current branch, but push mirrors generally do not use upstreams at all.
(Once you have enough commits on the remote, you can re-enable the push mirroring, since from there on, the "thin packs" you send up should be smaller: actually thin, instead of just theoretically thin :-) .)
这篇关于如何将Git镜像逐块推入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!