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 master?
问题:
回答1:
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.
回答2:
To change the default branch in Gitlab 7.7.2:
- Click Settings in the left-hand bar
- Change the Default Branch to the desired branch
- Click Save Changes.
回答3:
To change default branch in GitLab:
1. Settings > General > General project settings > Expand
2. Default Branch > Change your project default branch
3. Save changes
回答4:
In the latest GitLab Community Edition version 9.2.2.:
- You have to click on 'Settings' tab located at right most on tabs panel after opening the project.
- Under 'Settings' you will get section 'Default Branch' dropdown which will give you all branches for the repository. Select the desired branch.
- Scroll down to hit green colored 'Save changes' button located just after 'Project Avatar'.
Please refer image below:
回答5:
- Settings
- General
- General Project Settings
回答6:
In Gitlab CE 9.0, You can change the default branch from the Settings Tab in a repository's header.
回答7:
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.

