capabilities.work

Protect a branch or wildcard

One step with GitLab. We can help you get access.

Get something done

Protect a branch or wildcard

with GitLab
Works with AI assistants

Use GitLab: its GitLab REST Protected branches API lets you protect a branch or wildcard in a single step (POST /api/v4/projects/{id}/protected_branches). GitLab also has an MCP server, so an AI assistant like Claude or ChatGPT can do it for you. capabilities.work can help you get signed up and connected.

  • How do I protect the main branch so only maintainers can push?
  • Can I allow specific users to push to a protected branch?
  • Which access level do I use to protect a branch from force pushes?
Say it to your AI assistant
  • Protect branch {name} in project {id}.
  • Protect {name} in project {id} with code owner approval required set to {code_owner_approval_required}.
  • Allow users {allowed_to_push} to push to {name} in project {id}.
For your developer

POST /api/v4/projects/{id}/protected_branches in GitLab REST Protected branches API. Full spec on APIs.io.