如何以块的形式推送Git镜像?

时间:2016-11-17 10:47:31

标签: 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/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

这似乎有些常见,there are some solutions available包括一次指定要上传的提交块。但是我的repo是一个镜像克隆,不适用于指定的refspecs:

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

关于如何将镜像仓库以块的形式推送到远程上游的任何想法?

1 个答案:

答案 0 :(得分:1)

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

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

你可能也不想要-u,因为它设置了当前分支的上游,但推镜通常根本不使用上游。

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