Skip to main content

Protected git branches

You can prevent accidental changes in Modelbit with protected branches. Modelbit works with your branch protection rules in GitHub and GitLab by preventing changes that don't come from approved merge requests.

You must first connect GitHub or GitLab to your Modelbit workspace to use protected branches. Once your repository is connected you can enable branch protection for any branch in the Git Settings tab by changing the Protected toggle.



Deployments, datasets, endpoints, and other assets on protected branches will no longer be editable in Modelbit's web app or using the modelbit Python package. All changes must be made through merge requests in your connected GitHub or GitLab repository.

Understanding branch protection

Branch protection rules are governed by the Git provider and not the repository. Configuring branch protection means turning it on in both Modelbit and in GitHub/GitLab. Then, Modelbit will enforce branch protection when users are in Modelbit, and GitHub/GitLab will enforce branch protection rules when users are over there.

In order for Modelbit to continue syncing with the copy of your repo in your Git provider branch protection rules cannot apply to Modelbit's access to your GitHub/GitLab. Make sure that Modelbit's deploy key is allowed to bypass branch protection rules.