Add team access restrictions
/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams 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.
Grants the specified teams push access for this branch. You can also give push access to child teams.
Parameters
path Path Parameters
| Name | Type |
|---|---|
owner
required
The account owner of the repository. The name is not case sensitive. | string |
repo
required
The name of the repository without the | string |
branch
required
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API. | string |
Request Body
Responses
Response
id: number;
node_id: string;
name: string;
slug: string;
description: string | null;
privacy?: string;
notification_setting?: string;
permission: string;
permissions?: {
pull: boolean;
triage: boolean;
push: boolean;
maintain: boolean;
admin: boolean;
};
url: string;
html_url: string;
members_url: string;
repositories_url: string;
type: "enterprise" | "organization";
organization_id?: number;
enterprise_id?: number;
parent:
}[]
Client Errors
Validation failed, or the endpoint has been spammed.
message: string;
documentation_url: string;
errors?: {
resource?: string;
field?: string;
message?: string;
code: string;
index?: number;
value?: string[] | string | number | null;
}[];
}