gitgithub

Find out the admin(s) for a git repo


I am a contributor for a git repo in github for a company.

I want to find out who among the contributors are the admins.

How do I find out who is the admin besides going around and asking everyone in the company?


Solution

  • 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 ]'