推送大型 github 存储库失败,“无法推送到不合格的目的地:master"; [英] Pushing a large github repo fails with "unable to push to unqualified destination: master"

查看:24
本文介绍了推送大型 github 存储库失败,“无法推送到不合格的目的地:master";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大型 git 存储库(从 SVN 存储库创建),我想将它推送到 github.鉴于它很大,我不能只是尝试直接推送它,因为它会因pack too large"错误而失败.

I have a large git repo (created from an SVN repo) and I want to push it to github. Given it's large, I can't just try and push it directly, as it fails with a "pack too large" error.

到目前为止一切都很好,我可以一次推送一个 repo.但是当我尝试这样做时会发生什么:

All good so far, I can push the repo one commit at a time. But when I try to do this what happens is:

git push origin 86c310d8a680d6d0e052fa7db89adb25348f3e54:master
error: unable to push to unqualified destination: master
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.

因此,远程存储库中还没有 master 分支,但我正在尝试推送它并且失败了.

So, there is no master branch at the remote repo yet, but I'm trying to push to it and it fails.

我该如何解决这个问题?或者我如何在远程创建一个空的 master 分支以便我可以推送到它?

How do I fix this? Or how do I create an empty master branch at the remote so I can push to it?

推荐答案

推送到 refs/heads/master,就这一次.

git push origin 随便:refs/heads/master

这将明确地将其创建为一个分支,并且您将来可以正常推送到它.

That will create it unambiguously as a branch, and you'll be able to push to it normally in the future.

这是可行的,因为没有名为 master 的远程 ref(它还没有被创建),目标 ref 不是完全限定的 refs/所以 git 无法根据它找出它,而源 ref是一个散列而不是一个名称,所以它也无法根据它来弄清楚.通过推送到 refs/heads/master 它可以工作,因为第二个条件为真,然后 master 存在于遥控器上,因此第一个条件为真

This works because there's no remote ref named master (it hasn't been created yet), the target ref isn't fully-qualified with refs/ so git can't figure it out based on that, and the source ref is a hash rather than a name, so it can't figure it out based on that either. By pushing to refs/heads/master it works because the second condition is true, and then afterwards master exists on the remote so the first condition is true

这篇关于推送大型 github 存储库失败,“无法推送到不合格的目的地:master";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆