Change Default branch in gitlab

前端 未结 13 2098
[愿得一人]
[愿得一人] 2020-12-07 19:35

I accidentally pushed my local master to a branch called origin on gitlab and now it is the default. Is there a way to rename this branch or set a new master branch to maste

相关标签:
13条回答
  • 2020-12-07 20:09

    For gitlab v10+ (as of Sept 2018), this has moved to settings-> repository -> default branch

    0 讨论(0)
  • 2020-12-07 20:12

    In 8.0+ it looks like this was moved into the project. If you open your project and go to the gear icon on the right, then "Edit Project" you can set the default branch for the project.

    0 讨论(0)
  • 2020-12-07 20:16

    First I needed to remote into my server with ssh. If someone has a non ssh way of doing this please post.

    I found my bare repositories at

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

    used

    git branch 
    

    to see the wrong active branch

    git symbolic-ref HEAD refs/heads/master
    

    to change the master to to be the branch called master then use the web interface and "git branch" to confirm.

    0 讨论(0)
  • 2020-12-07 20:17

    In Gitlab version v11.4.4-ee, you can:

    1. Setting
    2. Repository
    3. Default Branch

    Click me

    0 讨论(0)
  • 2020-12-07 20:17

    Settings > Repository > Default Branch

    enter image description here

    0 讨论(0)
  • 2020-12-07 20:19

    For GitLab 11.5.0-ee, go to https://gitlab.com/<username>/<project name>/settings/repository.

    You should see:

    Default Branch

    Select the branch you want to set as the default for this project. All merge requests and commits will automatically be made against this branch unless you specify a different one.

    Click Expand, select a branch, and click Save Changes.

    0 讨论(0)
提交回复
热议问题