Git clone does not bring master branch

余生颓废 提交于 2019-12-01 04:18:46

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)

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

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.

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