Double deploy at same commit

Hi there,
my site’s deploy is configured using a gitlab repo, but at each commit it build and deploy twice. I can’t understand why it behaves like this. I searched and also asked the AI (who doesn’t answer me) but I can’t find a solution.

Hi @dedonnodev :wave:t6: welcome to the forums! This is because of continuous deployment so every time you push a commit to your repo Netlify will automatically run your build and deploy the result.

If you want to pause automatic publishing of your production branch, you can lock a deploy and stop auto-publishing to your site’s designated production branch. To change the production branch name, go to Site configuration > Build & deploy > Continuous Deployment > Branches and deploy contexts, and select Configure.

Hi @SamO, thanks for the answer, but the problem is that with each commit it performs a double build and deploy.

As you can see from the screenshot, the commit is the same but it has done two builds and two deployments.

This is a common issue with GitLab. Go to your repo’s webhook’s settings and make sure there’s just a single webhook pointing to Netlify.

Hi @hrishikesh, the problem is that i do not use webhook with gitlab. I directly linked the repo to netlify and it build and deploy automatically. But it does it twice for each commit

Hi, @dedonnodev. At GitLab, Netlify automatically creates the webhook for new commits for you via the GitLab API. This means that GitLab is definitely using webhooks to tell Netlify when to build, even if you did not personally add those webhook to the GitLab repo.

The usual root cause is that the site has been linked to two site or re-linked to the existing site. The API call that makes the webhook will do so each time the repo is linked. However, it doesn’t check to see if the webhook already exists which then results in two webhooks existing when only one is required.

Again, if you would please check for duplicate webhook in the GitLab repo, that is nearly always the root cause of this type of issue.

Thank you all so much, now I understand what you meant.