List all (private) repositories of a GitHub organization

Viewed 1158

I am the owner of a GitHub organization. All repos in that org are set to private. In the web UI dashboard, I can see that there are 112 repos in my organization. However, when I request all repositories via API (https://docs.github.com/en/rest/reference/repos#list-organization-repositories) I only get around 30 of these back.

curl -i -u username:oauth-token https://api.github.com/orgs/org/repos

Adding a query string like ?type=all to the URL does not make any difference.

Thank you for your help and ideas.

K

2 Answers

By default GitHub API returns 30 results per page here. Just as said in the doc link, try setting per_page (max 100) to get more:

https://api.github.com/orgs/org/repos?per_page=100

And use page parameter to get next pages:

https://api.github.com/orgs/org/repos?per_page=100&page=2
Related