Beware in your CI/CD configuration that 'master' is now "main"

I just created a new repository, with the exactly the same settings as a number of older ones.

Commits to this new repository did not trigger the pipeline …

After about an hour of fruitlessly trying to figure out the reason I just noticed the following in the .gitlab-ci.yml file:

- master

For recent repositories that must read:

- main

Hope this saves you some time!

1 Like

If main or master is your default branch, you can just use $CI_DEFAULT_BRANCH, which is a bit more descriptive. The full list of predefined variables can be found here


@snim2 thanks, using that variable all .gitlab-ci.yml files are identical in all these repositories regardless of their age and usage of main or master

1 Like

Just reverted all .gitlab-ci.yml files appearantly $CI_DEFAULT_BRANCH does not work in “only:”.

Really? It certainly works with rules

Yes really. When i put:



in my .gitlab-ci.yml files no pipelinese were triggered. Once i reverted them to either:


  • master



  • main

Depending on the repository being more recent (main) or older (master) the pipelines triggered on the commit once more.

So, if you check your repository settings, is main your default branch?

Depending on the age of the repository the default branch is set correctly on all of them.

For the older ones it is: master
For the more recent ones it is: main

Is this on GitLab SASS? The CI_DEFAULT_BRANCH variable has been available since 12.4, so if you are seeing that on SASS I’d suggest that it’s a bug…

Here’s a test repo with a:

This does look odd. Have you raised an issue?

Yes, this is on GitLab SASS.

Sounds like a good time for you to raise an issue!

1 Like