Git克隆不带主分支 [英] Git clone does not bring master branch

查看:195
本文介绍了Git克隆不带主分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个远程存储库 http://github.com/fernandezpablo85/Test



这个repo有一个 master 分支,但是它在两个其他分支之后,所以当我克隆它时,我得到了这个警告:


警告:远程HEAD引用不存在的ref,无法结帐。

并且我没有得到本地的 master 分支( git branch 什么也没有显示)。

我可以修复整个事情:

git checkout -b主要来源/主人



但我想知道为什么会发生这种情况?大师应该是更高级的分支吗?或者是否有其他问题我的回购?

解决方案

1 /否,master不是最高级的分支。一个可以只发布到另一个分支,然后删除该分支...



2当发生这种情况时,您应该选择master作为管理面板中的默认分支github回购,但这并不总是可能的。请参阅此错误


对于遇到此问题的其他人:

tekkub告诉我如何


  • 创建一个临时分支,

  • 通过freenode #github频道绕过这个bug。将它推送到您的回购库中,
  • 在该回购的管理面板中选择默认分支,然后删除分支并再次推送。
  • li>


为我们工作。

想法是临时拥有两个分支,以便能够在GUI管理面板中选择主设备作为默认设备,然后删除额外的分支)

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 I get this warining:

warning: remote HEAD refers to nonexistent ref, unable to checkout.

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

I can fix the whole thing doing:

git checkout -b master origin/master

But I was wondering why this happens? Is master supposed to be the more advanced branch? Or is there something else wrong with my repo?

解决方案

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)

这篇关于Git克隆不带主分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆