Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 1
Message 1 of 2

GitHub Enterprise - Scan All Repos As Site Admin

Solved! Go to Solution.

As a site admin, is there a way to add yourself as an owner to all organizations in a GitHub Enterprise instance?

 

Using https://developer.github.com/v3/repos/#list-organization-repositories to return all repos from an org which I am not a member of return only its public repos. This request is authorized using a PAT with access to all scopes and belongs to my site admin LDAP user. I can see the org has many private repos, and I'd like to be able to return all repos of all orgs as part of a total GitHub audit initiative. The default reports you can generate in the admin console and UI are not sufficient because I need a programmable way to return the last activity (e.g. commit) date from every repo.

1 Reply
Highlighted
Solution
Ground Controller Lvl 1
Message 2 of 2

Re: GitHub Enterprise - Scan All Repos As Site Admin

Just found https://help.github.com/en/enterprise/2.17/admin/installation/command-line-utilities#ghe-org-admin-p..., which can be used to promote a site admin to an owner of any org. To avoid sending other site admins an email for every org they are made an owner of, I did something like this to target only my user:

 

From admin shell:

 

for org in $(curl -u <user>:<token> https://<server>/api/v3/organizations \
| jq '.[].login' \
| cut -d '"' -f 2 \
| xargs echo); do ghe-org-admin-promote -u <user> -o $org -y; done