简体   繁体   中英

List ALL GitHub enterprise repos for an organization

My private github enterprise https://my.company.url/my_sub_org has around 250 repos

which I want to list.

I tried

$ curl -sX GET -H "Authorization: token ${mytoken}" https://my.company.url/api/v3/orgs/my_sub_org/repos?per_page=200| grep ssh_url | awk -F': ' '{print $2}'

but it returns only 100 matching the documentation here https://docs.github.com/en/rest/reference/repos#list-organization-repositories .

I also tried

gh repo list

but returns only stuff I own

and

gh repo my.company.url/my_sub_org

No results.

How do I list all the repos?

I can't comment yet but in that documentation, it says per_page is "Results per page (max 100)", and page as "Page number of the results to fetch" so maybe you need a loop to just iterate through different pages?

Edit 1: Github has a guide about traversing with pagination

I recently found the solution for listing GitHub Enterprise repos for a specific owner in an issue .

$ export GH_HOST=github.company.com
$ gh repo list <org/owner>

Showing 42 of 1337 repositories in @org/owner
[...]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM