Skip to content

Instantly share code, notes, and snippets.

View JCruiz15's full-sized avatar
🎯
Focusing

Juanca JCruiz15

🎯
Focusing
View GitHub Profile
@gene1wood
gene1wood / change-github-collaborators-permissions.md
Last active September 9, 2024 19:51
How to edit or modify a GitHub user's permissions on a repository through the API

The GitHub API is inconsistent for this endpoint. Normally to edit or modify a resource, the REST API uses the PATCH verb.

For the https://developer.github.com/v3/repos/collaborators/ endpoint however, to edit or modify a user's permissions, there is no PATCH verb. Instead you must make a PUT call defining the new permissions.

The documentation confusingly describes this as "Add user as a collaborator" when the user you're modifying already is a collaborator, you just want to change their permissions.

Here is an example call to change a user with push permissions to pull permissions