I want to get a list of all private repositories in our organisation github. I tried -

curl -u user:pw -X GET  https://api.github.com/orgs/xxx/repos?per_page=100 >> list.txt 

I figure out that the per_page MAX value is 100 , how can I get all our repos into one file ?

Thanks

Github CLI

This is now pretty easy to do via the GH CLI which takes care of all the auth stuff for you after you login.

gh repo list <username> --private

Manual

You'll need to create a personal access token, and then you can filter with type=private

Unless you have more than 100 repos, you can just do this:

https://api.github.com/orgs/<org>/repos?per_page=100&type=private&access_token=<token>

For more than 100 Repos

If you need to traverse more than 100 repos, you'll have to use some additional scripting.

Here's a sample in vanilla JS you can paste into your browser console

let orgName = 'YOUR_ORG_NAME'
let access_token = 'YOUR_ACCESS_TOKEN'

let baseUrl = `https://api.github.com/orgs/${orgName}/repos`
let params = {
    type: 'private',
    page: 1,
    per_page: 10,
    access_token
}

let repos = [], json = []

do {
    let queryString = new URLSearchParams(params).toString()
    let url = `${baseUrl}?${queryString}`

    let resp = await fetch(url)
    json = await resp.json()
    
    repos.push(...json)

    params.page++

} while (json.length == params.per_page)

console.log(repos)

Further Reading