当前位置: 首页 > 知识库问答 >
问题:

如何将Git镜像分块推送?

董凡
2023-03-14

我目前正在经历将一个大型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'

我尝试使用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

这似乎有点常见,有一些解决方案可用,包括指定每次上载的提交块。但是,my repo是镜像克隆,不适用于指定的参照规范:

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

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

共有1个答案

益富
2023-03-14

通过设置remote暂时禁用推送镜像。名称在git配置中将镜像为false。

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

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

(一旦你在遥控器上有足够的提交,你可以重新启用推送镜像,因为从那以后,你发送的“薄包”应该更小:实际上是薄的,而不仅仅是理论上的薄:-)。)

 类似资料:
  • Repo is a tool that we built on top of Git. Repo helps us manage the many Git repositories, does the uploads to our revision control system, and automates parts of the Android development workflow. Re

  • 如需克隆 QEMU 代码,使用 git clone https://mirrors.tuna.tsinghua.edu.cn/git/qemu.git 若要将 tuna mirror 加入已有代码库,可在已有仓库中运行 git remote add tuna https://mirrors.tuna.tsinghua.edu.cn/git/qemu.git 或运行 git remote set

  • Repo is a tool that we built on top of Git. Repo helps us manage the many Git repositories, does the uploads to our revision control system, and automates parts of the Android development workflow. Re

  • 如需克隆 GCC 代码,使用 git clone https://mirrors.tuna.tsinghua.edu.cn/git/gcc.git 若要将 tuna mirror 加入已有代码库,可在已有仓库中运行 git remote add tuna https://mirrors.tuna.tsinghua.edu.cn/git/gcc.git 或运行 git remote set-ur

  • 本项目包含三个镜像:linux.git, linux-stable.git, linux-next.git,分别是主分支、稳定版分支和开发分支。在使用时,请自行更改路径中相应的仓库名称。 如需克隆主线 linux 代码,使用 git clone https://mirrors.tuna.tsinghua.edu.cn/git/linux.git 若要将 tuna mirror 加入已有代码库,可

  • Docker新手:我在OSX用Docker desktop建立了我的本地开发环境。当我想把我的Docker映像推送到Dockerhub,并且我正在更新Docker文件时,我需要重新启动我的容器吗?还是没有必要?当我更新Dockerfile,用“最新”标签标记它,并将其推送到Dockerhub,然后试图通过Drone将其拉入Kubernetes时,它似乎一直是旧的Docker映像。至少Drone或K