The name of the branch.
Get a branch
Path Parameters
Response
application/json
Response
Response
Branch With Protection
Branch With Protection
Commit
Show Child Parameters
Show Child Parameters
Branch Protection
Show Child Parameters
Example:"mas*"
Example:1
Path Parameters
Get branch protection
Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub’s products in the GitHub Help documentation.
Path Parameters
The name of the branch.
Response
application/json
Response
Response
Branch Protection
Branch Protection
Protected Branch Required Status Check
Show Child Parameters
Protected Branch Admin Enforced
Show Child Parameters
Protected Branch Pull Request Review
Show Child Parameters
Branch Restriction Policy
Show Child Parameters
Show Child Parameters
Show Child Parameters
Show Child Parameters
Show Child Parameters
Example:"branch/with/protection"
Example:"https://api.github.com/repos/owner-79e94e2d36b3fd06a32bb213/AAA_Public_Repo/branches/branch/with/protection/protection"
Show Child Parameters
Path Parameters
Update branch protection
Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub’s products in the GitHub Help documentation.
Protecting a branch requires admin or owner permissions to the repository.
Note: Passing new arrays of users
and teams
replaces their previous values.
Note: The list of users, apps, and teams in total is limited to 100 items.
Path Parameters
The name of the branch.
Body
application/json
Body
Require status checks to pass before merging. Set to null
to disable.
Show Child Parameters
Enforce all configured restrictions for administrators. Set to true
to enforce required status checks for repository administrators. Set to null
to disable.
Require at least one approving review on a pull request, before merging. Set to null
to disable.
Show Child Parameters
Restrict who can push to the protected branch. User, app, and team restrictions
are only available for organization-owned repositories. Set to null
to disable.
Show Child Parameters
Enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch. Set to true
to enforce a linear commit history. Set to false
to disable a linear commit Git history. Your repository must allow squash merging or rebase merging before you can enable a linear commit history. Default: false
. For more information, see “Requiring a linear commit history” in the GitHub Help documentation.
Permits force pushes to the protected branch by anyone with write access to the repository. Set to true
to allow force pushes. Set to false
or null
to block force pushes. Default: false
. For more information, see “Enabling force pushes to a protected branch” in the GitHub Help documentation."
Allows deletion of the protected branch by anyone with write access to the repository. Set to false
to prevent deletion of the protected branch. Default: false
. For more information, see “Enabling force pushes to a protected branch” in the GitHub Help documentation.
Requires all conversations on code to be resolved before a pull request can be merged into a branch that matches this rule. Set to false
to disable. Default: false
.
The list of status checks to require in order to merge into this branch.
Response
application/json
Response
Response
Protected Branch
Branch protections protect branches
Status Check Policy
Show Child Parameters
Show Child Parameters
Show Child Parameters
Show Child Parameters
Show Child Parameters
Show Child Parameters
Show Child Parameters
Branch Restriction Policy
Show Child Parameters
Show Child Parameters
Path Parameters
Body
Delete branch protection
Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub’s products in the GitHub Help documentation.
Path Parameters
The name of the branch.
Response
Response
Response
Path Parameters
Get admin branch protection
Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub’s products in the GitHub Help documentation.
Path Parameters
The name of the branch.
Response
200 application/json
Response
Response
Protected Branch Admin Enforced
Protected Branch Admin Enforced
Example:https://api.github.com/repos/octocat/Hello-World/branches/master/protection/enforce_admins
Example:true