更改gitlab中的默认分支

Change Default branch in gitlab

我不小心将本地主服务器推送到了gitlab上一个名为origin的分支,现在它是默认分支。是否可以重命名此分支或将新的master分支设置为master?


在8.0中,这似乎已移到项目中。如果打开项目并转到右侧的齿轮图标,则"编辑项目"可以为项目设置默认分支。


要在GitLab中更改默认分支,请执行以下操作:
1.设置>常规>常规项目设置>展开
2.默认分支>更改项目的默认分支
3.保存更改

enter


对于gitlab v10(截至2018年9月),此内容已移至设置->存储库->默认分支

enter


要在Gitlab 7.7.2中更改默认分支:

  • 点击左侧栏中的设置
  • 将默认分支更改为所需的分支
  • 单击保存更改。


  • 设定值
  • 一般的
  • 常规项目设置
  • Setting 打开项目后的面板。

  • 在"设置"下,您会看到"默认分支"部分
    这将为您提供存储库的所有分支。选择所需的分支。
  • 向下滚动以点击位于旁边的绿色"保存更改"按钮
    在"阿凡达计划"之后。
  • 请参考下图:

    enter

    GitLab 13.9(2021年2月)详细信息:

    Git default branch name change

    Every Git repository has an initial branch. It’s the first branch to be created automatically when you create a new repository.
    By default, this initial branch is named master.

    Git version 2.31.0 (scheduled for release March 15, 2021) will change the default branch name in Git from master to main.

    In coordination with the Git project and the broader community, GitLab will be changing the default branch name for new projects on both our SaaS (GitLab.com) and self-managed offerings starting with GitLab 14.0.
    This will not affect existing projects.

    For more information, see the related epic and the Git mailing list discussion.

    Deprecation date: Apr 22, 2021


    设置>存储库>默认分支

    enter


    在Gitlab CE 9.0中,您可以从存储库标题中的"设置"选项卡更改默认分支。


    首先,我需要使用ssh远程访问服务器。如果某人有非ssh的方法,请发布。

    我在

    找到了裸存储库

    1
    cd /var/opt/gitlab/git-data/repositories/group-name/project-name.git

    二手

    1
    git branch

    查看错误的活动分支

    1
    git symbolic-ref HEAD refs/heads/master

    将主节点更改为称为master的分支,然后使用Web界面和" git分支"进行确认。