How to a list of repos belonging to a user in github? - github

For each user in github, there is "repositories" number which is owned by the user:
How do we enumerate all these repos programmatically?
There is a API called "https://api.github.com/users/{username}/repos" which can enumerate some of the repos, but it is not a complete list - as it is not listing a lot of the repos which I had created and is listed at the github.com website.
PS:
A somewhat similar question is asked here: List repos of a user but its answer is also not correct.

Using the GitHub cli gh repo list command should help.
It should manage the API pagination, and return a full list.

Related

Github API - how can I get a list of users assigned individual rights to a repo

I have a repo in GitHub and I'm trying to get a handle on what permissions have been assigned to it. I am admin on the repo.
When I call gh api "https://api.github.com/repos/:org/:repo/teams" it returns the teams which have been assigned roles. Win!
However I know that some people have direct permissions applied to their users, not through a team. I want to see who these people are but can't find out how to do so through the API. I have nearly 300 repos to check so don't want to do it manually.
I know I could look through the contributors but my whole company has read rights to the repo so it's like to be hundreds of people and that sounds painful.
Is there a more direct way that I'm missing?

Gist in GitHub Enterprise if user left company

My company uses GitHub Enterprise. Some people are creating Gists to share simple codes. I searched, and it is not possible to create "organization gists".
What will happen to those gists if the person who created them leaves the company (and is no longer listed/member of the GitHub Enterprise)?
As outlined in the documentation,
If employees leave the company, you can suspend their GitHub Enterprise Server accounts to open up user licenses in your GitHub Enterprise license while preserving the issues, comments, repositories, gists, and other data they created. Suspended users cannot sign in to your instance, nor can they push or pull code.
The key part of the above quote is "preserving the issues, comments, repositories, gists, and other data." Their Gists remain in GitHub Enterprise Server, even though their owner can no longer access them.
While Gists are git repositories, there is no way to transfer ownership of a Gist. Instead, you can fork and clone Gists or use a technique like this to move the Gist to a regular Git repository.

Listing GitHub repos created by a specific user

Is there a way to list all repositories within an organization, created or contributed to by a specific user?
For concreteness, I am a member of the organization and I am the user in question.
The organization page has a ton of repos listed and I just want to see the ones that I made.

GitHub: How to list all the private repositories that a particular user has forked?

When you remove a user from an organization, GitHub warns you that all their forks of the organisation's private repos will be deleted
Removing people from the XX organization will also delete their forks of any private XX-owned repositories.
And GitHub tells you how many private forks the user has but it does not tell you the repo names (even though I have permission to see them!)
It would be useful to see the repos so that I can check that they really have no outstanding, potentially useful, work left on branches (that they have not opened pull-request for).
To do it from the Web U:
Go to the people tab of the organization (https://github.com/orgs/myorg/people).
Filter/find the person.
Click their name; this will take you to https://github.com/orgs/myorg/people/theirusername, which lists all repos they have access to, including repos in the organization and forks the user has made of them.
Filter the list by their username; this will show just the forks.
This requires owner permissions for the organization.
There's a GitHub API to list all the forks. I haven't tested the API but I assume that you will get ONLY the public forks for other users and all the forks if you're the authenticated user.
If you wanted to query this on behalf of other users you can work on a GitHub Integration that would get users' permissions via OAuth and then you could store that information on your side for a whole group of people.
I don't think this is what you were asking for but additionally there's a WEB UI filter for forked repositories, e.g., https://github.com/defunkt?utf8=%E2%9C%93&tab=repositories&q=&type=fork.

How to merge several Github users?

I am newbie github users and mistakenly created two github user accounts. I'm wondering how can we merge two github users account into one, including their corresponding repositories? any idea?
A quick something search will give you this:
Transfer any repositories from the account you want to delete to the account you want to keep. Issues, pull requests, and wikis are transferred as well. Verify the repositories exist on the account you want to keep.
Update the remote URLs in any local clones of the repositories that were moved.
Delete the account you no longer want to use.