Git克隆不带主分支

编程入门 行业动态 更新时间:2024-10-25 15:31:48
本文介绍了Git克隆不带主分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个远程存储库 github/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 github/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克隆不带主分支

本文发布于:2023-11-26 18:40:32,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不带   分支   Git

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!