How to fetch user and org repositories simultaneously using search api with username? api returns repositories that the authenticated user has explicit permission (:read, :write, or :admin) to access. ( It includes both the user repos and org repos if any). api returns all the public repos in GitHub.

I can restrict by adding user:username in q to return only user repos. But this returned list does not contain org repos which user has access to.

Is there any way to get both user repos and org repos simultaneously using search api like the first api gives?

One solution I see is, to add org:orgname in q along with user:username but I don’t want to do this because I do not have org detail available with me for that user. I only have username. Also I don’t want to make another api call to fetch org associated to that username.

Hoping for an early response!

It sounds like what you’re trying to do is search all the repositories that some other user account, not your own, has access to? That’s not possible with our API because that would be a breach of that user’s privacy. That’s also why there is only a “list your repositories” API and not a “list the repositories the named user has access to” API.

Please let me know if I’m misunderstanding your goal.