Find out who is the admin(s) for a git repo
If you have push access to this repository, you can use Github API to find collaborators
You will need an access token, the endpoint https://api.github.com/repos/ORG/REPO/collaborators
gives you a list of all collaborators with the list of permission type for each of them :
"permissions": {
"admin": true,
"push": true,
"pull": true
}
You can use curl
and jq
(to parse JSON response) like this :
curl https://api.github.com/repos/ORG/REPO/collaborators \
-H "Authorization: Token ACCESS_TOKEN" | \
jq '[ .[] | select(.permissions.admin == true) | .login ]'
You can also use the v4 (GraphQL) API for this:
query {
repository (owner:"ORG",name:"REPO") {
collaborators (first:100) {
totalCount
edges {
permission
node {
login
name
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
}
and look for results that have "permission": "ADMIN"