Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list organization's private repositories via GitHub API?

I'm trying to get a list of an organization's all repositories, including private ones. (Or to be more specific, all of the private repositories a certain user has access to.)

Reqesting info for the organization (https://api.github.com/orgs/acme?access_token=[...]) shows that there indeed are plenty of private repositories:

... "public_repos": 5, "total_private_repos": 68,  "owned_private_repos": 68,  ... 

(The access token I'm using had been previously generated using the API for username/passwd.)

But whatever I try to list the repos...

https://api.github.com/orgs/acme/repos?access_token=[...]    

...GitHub API just returns the 5 public repositories. (Documentation says type=all is default. Also tried adding the parameter type=private; no difference.)

Any idea what I'm doing wrong?

The user to whom the access token was generated in fact has Push & Pull access to just some of the organization's private repositories, but none of those appear in the list I get (just the 5 public repositories).

like image 293
Jonik Avatar asked Jun 06 '13 12:06

Jonik


People also ask

Can you see private repositories on GitHub?

Public repositories are accessible to everyone on the internet. Private repositories are only accessible to you, people you explicitly share access with, and, for organization repositories, certain organization members.

How do I retrieve all GitHub repositories of an organization?

Hitting https://api.github.com/users/USERNAME/repos will list public repositories for the user USERNAME. Show activity on this post. to find all the user's repos.

How do I see all repositories in GitHub?

You can search globally across all of GitHub, or scope your search to a particular repository or organization. To search globally across all of GitHub, type what you're looking for into the search field at the top of any page, and choose "All GitHub" in the search drop-down menu.


1 Answers

Everything you are doing is OK. However, when creating OAuth tokens for authentication, be sure that you are defining the right scopes. Each scope defines a specific set of permitted actions (information you can read/write), so you should check that you are creating the token with the repo scope.

like image 142
Ivan Zuzak Avatar answered Sep 21 '22 02:09

Ivan Zuzak