repositories
put/repositories/{repository}/settings/branch_protection

Request

  • Base URL
    /api/v1 (relative, and the document was published on a file host, not at the API’s origin)
  • URL
    /api/v1/repositories/{repository}/settings/branch_protection
  • Auth
    • HTTP bearer
    • or HTTP basic
    • or API key in cookie internal_auth_session

Headers

If-Matchstring

if provided, the branch protection rules will be updated only if the current ETag match the provided value

Request body

patternstring required

fnmatch pattern for the branch name, supporting * and ? wildcards

Example request

[
  {
    "pattern": "stable_*"
  }
]

Response

branch protection rule created successfully

Changes

    • info

      added the non-success response with the status

    • info

      removed the non-success response with the status

    • info

      added the non-success response with the status

    • info

      removed the non-success response with the status