Skip to content

Instantly share code, notes, and snippets.

@IvanWei
Last active September 28, 2017 02:59
Show Gist options
  • Save IvanWei/54d2619f27ec240c63536e142b65837b to your computer and use it in GitHub Desktop.
Save IvanWei/54d2619f27ec240c63536e142b65837b to your computer and use it in GitHub Desktop.
View, add, delete collaborator on Github repository

View collaborator's permission on Github repository

curl -u [owner] \
  https://api.github.com/repos/[owner]/[repository]/collaborators/[username]/permission

Add user as a collaborator to Github repository has admin permission

  • admin: read, write, admin
  • push: read, write ( default when add user as a conaborator )
  • pull: read
curl -i -u [owner] -X PUT \
  -H 'Accept: application/vnd.github.v3.full+json' \
  -d '{"permission":"[admin/push/pull]"}' \
  https://api.github.com/repos/[owner]/[repository]/collaborators/[username]

Delete collaborator on Github repository

curl -i -u [owner] -X DELETE \
  https://api.github.com/repos/[owner]/[repository]/collaborators/[username]

Reference

Github API V3 - Collaborators

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment