How to get list of PRIVATE repositories with api call

We are trying to access a user’s repositories list (including public and private). For this we have created a GitHub App in a github account and we have given read permissions to everything. We try to make the following calls by passing it the Oauth 2.0 token:

https://api.github.com/users/USERNAME/repos

https://api.github.com/search/repositories?q=user:USERNAME

This only returns the user’s public repositories.

The next call also cannot access the private repositories
https://api.github.com/repos/USERNAME/REPONAME/commits

We have also tried with {type: all} and {visibility: all}

Hope you can help me access all repositories and commits, thanks.

2 Likes

@Pcamachoc, any APIs will only provide publicly available information about another users GitHub account. Another users Private repository, or private email is not publicly available information.

You can list the the private repositories of the authenticated/current user, or repositories they have access to.
Maybe something like List repositories for the authenticated user

1 Like