Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find out who is the admin(s) for a git repo

Tags:

git

github

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?

like image 446
ThinkBonobo Avatar asked Mar 01 '17 17:03

ThinkBonobo


People also ask

How do I find my GitHub admin?

In the top right corner of GitHub.com, click your profile photo, then click Your organizations. Click the name of your organization. Under your organization name, click People. You will see a list of the people in your organization.

Who is the owner of a GitHub repo?

Code owners are individuals or teams that are responsible for code in a repository. Project maintainers can add a CODEOWNERS file to their repository to make it easier for others to identify code owners and have code owners be notified to review Issues and Pull Requests.

How do I see git repository permissions?

Open Security for a repository You set Git repository permissions from Project Settings>Repositories. Open the web portal and choose the project where you want to add users or groups. To choose another project, see Switch project, repository, team. Open Project settings>Repositories.

How do I see who is on a repository?

Navigate to the members list, click on each member, and check which rights they are granted on the repo in question. Then go to the repo itself, and under settings, click collaborators, and see who is listed there. You now have a list of people with read/write access to the repo.


2 Answers

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 ]' 
like image 168
Bertrand Martel Avatar answered Oct 04 '22 17:10

Bertrand Martel


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"

like image 24
jnnnnn Avatar answered Oct 04 '22 19:10

jnnnnn