Git clone does not bring master branch

后端 未结 3 1367
灰色年华
灰色年华 2021-01-12 12:30

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

This repo has a master branch, but it\'s behind two other branches so when I clone it

相关标签:
3条回答
  • 2021-01-12 12:53

    We had a similar issue with one of our repositories, though in our case, the github admin panel was showing "master" as the default branch, but checkouts were getting a different branch by default. Changing the default to one of the other branches, then back to "master" fixed our problem.

    0 讨论(0)
  • 2021-01-12 13:00

    1/ No, master is not necessary the most advanced branch. One can publish only to another branch, and then delete that branch...

    2/ When that happen, you should select master as the default branch from the admin panel of the github repo, but that is not always possible. See this bug

    For anyone else who has hit this issue:

    tekkub told me how to get around this bug via the freenode #github channel.

    • create a temporary branch,
    • push that to your repo,
    • select the default branch in the admin panel for that repo,
    • then delete the branch and push again.

    Worked for us.

    (the idea is to temporary have two branches, in order to be able to select master as default with the GUI admin panel, and then delete the extra branch)

    0 讨论(0)
  • 2021-01-12 13:00

    If you only want to clone the master branch, then run this 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
    
    0 讨论(0)
提交回复
热议问题