Pushing a large github repo fails with “unable to push to unqualified destination: master”

匿名 (未验证) 提交于 2019-12-03 01:18:02

问题:

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.

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. 

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

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

回答1:

Push to refs/heads/master, just this one time. That will create it unambiguously as a branch, and you'll be able to push to it normally in the future.



回答2:

I had this same error and found that I'd spelled the name of my branch wrong. So you could find that double checking the branch name to ensure any capital letters etc are in the right place.



回答3:

You can also create a new branch with

git checkout -b branchName 

and then push your git repository to that branch

git push origin whatever:branchName 


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!