推送大型 github 回购失败 "unable to push to unqualified destination: master"
Pushing a large github repo fails with "unable to push to unqualified destination: master"
我有一个很大的 git 存储库(从 SVN 存储库创建),我想将它推送到 github。鉴于它很大,我不能直接尝试推送它,因为它失败并显示 "pack too large" 错误。
到目前为止都很好,我可以一次推送一个提交。但是当我尝试这样做时,发生的事情是:
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 分支,但我试图推送到它,但它失败了。
我该如何解决这个问题?或者我如何在远程创建一个空的 master 分支以便我可以推送到它?
推送到 refs/heads/master
,仅此一次。
git push origin whatever:refs/heads/master
这将明确地创建它作为一个分支,您以后就可以正常推送它了。
这是可行的,因为没有名为 master 的远程引用(尚未创建),目标引用不完全符合 refs/ 所以 git 无法根据那个,源引用是一个散列而不是一个名称,所以它也不能基于那个来计算它。通过推送到 refs/heads/master 它可以工作,因为第二个条件为真,然后 master 存在于远程所以第一个条件为真
我遇到了同样的错误,发现我把我的分支名称拼错了。所以你会发现仔细检查分支名称以确保任何大写字母等都在正确的位置。
您还可以使用
创建一个新分支
git checkout -b branchName
然后将您的 git 存储库推送到该分支
git push origin whatever:branchName
这对我有用:我在 github UI 上创建了远程分支,然后推送了与它同名的本地分支。如果其他方法不起作用,请尝试一下。其他方法是在本地创建一个新分支并推送一个空分支,然后挑选您的提交并再次推送到您的远程。
检查这个以及类似的问题:
When deleting remote git branch "error: unable to push to unqualified destination"
我有一个很大的 git 存储库(从 SVN 存储库创建),我想将它推送到 github。鉴于它很大,我不能直接尝试推送它,因为它失败并显示 "pack too large" 错误。
到目前为止都很好,我可以一次推送一个提交。但是当我尝试这样做时,发生的事情是:
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 分支,但我试图推送到它,但它失败了。
我该如何解决这个问题?或者我如何在远程创建一个空的 master 分支以便我可以推送到它?
推送到 refs/heads/master
,仅此一次。
git push origin whatever:refs/heads/master
这将明确地创建它作为一个分支,您以后就可以正常推送它了。
这是可行的,因为没有名为 master 的远程引用(尚未创建),目标引用不完全符合 refs/ 所以 git 无法根据那个,源引用是一个散列而不是一个名称,所以它也不能基于那个来计算它。通过推送到 refs/heads/master 它可以工作,因为第二个条件为真,然后 master 存在于远程所以第一个条件为真
我遇到了同样的错误,发现我把我的分支名称拼错了。所以你会发现仔细检查分支名称以确保任何大写字母等都在正确的位置。
您还可以使用
创建一个新分支git checkout -b branchName
然后将您的 git 存储库推送到该分支
git push origin whatever:branchName
这对我有用:我在 github UI 上创建了远程分支,然后推送了与它同名的本地分支。如果其他方法不起作用,请尝试一下。其他方法是在本地创建一个新分支并推送一个空分支,然后挑选您的提交并再次推送到您的远程。
检查这个以及类似的问题: When deleting remote git branch "error: unable to push to unqualified destination"