Skip to main content

Add or update team repository permissions (Legacy)

Deprecated

**Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new "[Add or update team repository permissions](https://docs.github.com/[email protected]/rest/reference/teams#add-or-update-team-repository-permissions)" endpoint. To add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a `422 Unprocessable Entity` status if you attempt to add a repository to a team that is not owned by the organization. Note that, if you choose not to pass any parameters, you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/[email protected]/rest/overview/resources-in-the-rest-api#http-verbs)."

PUT/teams/{team_id}/repos/{owner}/{repo}
Source
github-v3-rest.json
Revision
f5f067c1e6f6
Active snapshot
85e53e3d0d65

Request

Path Parameters
team_id integer
required
owner string
required
repo string
required
Body Params
optional
application/jsonobject
permission string
optional

The permission to grant the team on this repository. Can be one of: \* `pull` - team members can pull, but not push to or administer this repository. \* `push` - team members can pull and push, but not administer this repository. \* `admin` - team members can pull, push and administer this repository. If no permission is specified, the team's `permission` attribute will be used to determine what permission to grant the team on this repository.

Responses

Response

application/json Basic Error object

Forbidden

documentation_url string
optional
message string
optional
status string
optional
url string
optional
application/json Validation Error object

Validation failed

documentation_url string
required
errors array[object]
optional
items object
code string
required
field string
optional
index integer
optional
message string
optional
resource string
optional
value
optional
message string
required