Git clone does not carry a leading branch

I have a remote repository http://github.com/fernandezpablo85/Test

There is a master branch in this repo, but it is behind two other branches, so when I clone it, I get this command:

warning: remote HEAD refers to a non-existent ref that is unable to verify.

And also I don't get the local master branch ( git branch shows nothing).

I can fix all of this:

git checkout -b master origin/master

But I was wondering why this is happening? Is the host supposed to be a more developed industry? Or is there something else wrong with my repo?

+7
git
source share
3 answers

1 / No, the master is not needed by the most advanced branch. You can publish only another branch, and then delete this branch ...

2 / If this happens, you should select master as the default branch from the github repo admin panel, but this is not always possible. See this error

For everyone who got into this problem:

tekkub told me how to get around this error through the freenode #github channel.

  • create a temporary branch
  • click on your repo
  • select the default branch in the admin panel for this repo,
  • then delete the branch and click again.

Worked for us.

(the idea is to have temporary two branches, to be able to select the default wizard using the GUI admin panel, and then delete the additional branch)

+8
source share

If you only want to clone the main branch, run the following command:

 git clone git@github.com:**username**/ **Repository URL** -b master 

Here is an example:

 git clone git@github.com:gfranko/jquery.selectBoxIt.js.git -b master 
+11
source share

We had a similar problem with one of our repositories, although in our case the github admin panel showed the "master" as the default branch, but different branches received the default checks. Changing the default value for one of the other branches and then returning to "master" fixed our problem.

+1
source share

All Articles