Wiki default branch

Hi,

I would like to change the default branch of the wiki but I can’t. The official documentation says that the wiki default branch is the same as the project. I do not find this to be the case. My project default is master, while the wiki default is main. I would like to chang the wiki default but nothing so far works.

I would also like to allow forced pushes to the default branch. I suppose this is not possible because the default branch is protected by default - but I have no idea how/where to change this behaviour.

Any tips/help/suggestions would be awesome. Thanks!

Hi,

I’m assuming you are using Gitlab 14.1 or higher, so, if your project was created before this version, then yes, it will be master, since the default changed to main later. As the docs say:

So go to Admin → Settings → Repository and then expand Default Branch. You can also do this at group level, select the group and then in the group set the default branch.

What does it say in the initial branch name? After we upgraded, I changed this value to master. Therefore, I would assume based on the docs above, that if you didn’t change this value, then your wiki will default to main. If you change this and set it to master, then when you create a wiki it will use the master branch. Also any new projects created will also use master instead of main.

As for protected branches, select the project, then go to Settings → Repository and expand the protected branch section. Then you can disable protected branches for the ones that are configured.

1 Like

Hi,

Sorry, I don’t understand the solution.

How can the Default Branch of the wiki be change ?

I can find a Default Branch for the project but not for the git repository associated to the wiki.

It’s probably a silly question, but I’m stuck.

Thanks for the helps

The wiki uses the same branch name that is the default for the repositories. So if the repository has default branch main then the wiki has main. If your repository has a default branch of master then your wiki has master.

You cannot set the wiki branch separately.

I have a project where the wiki and the repo both have branches: “main”, “master” and “temp”.

The wiki’s default branch is “master”.

The repo’s default branch is “main”.

When the default branch is switch to “temp” or “main”, the wiki’s default branch remains on “master”.

What can I do to have both the wiki and the repo with a default branch pointing to “main” ?

I alread said, you cannot set the wiki branch separately. It has obviously chosen master, since you had master in the project as the default probably before any other branches existed.

Maybe open an gitlab issue here and ask maybe if the devs will allow people to configure the wiki branch: Issues · GitLab.org / GitLab · GitLab if it gets enough votes, maybe they will integrate it. If not, then you just have to live with the fact that the wiki branch cannot be changed.