List all GitHub public repositories for a user
A simple one-liner method to
list all the public repositories for a GitHub user
using the GitHub API and curl is below.
Note that as shown, without giving an API token, the query will be rate limited. The JSON array will be empty if the user profile is private or if the user has no public repositories:
GitHub:
curl -s -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2026-03-10" https://api.github.com/users/USERNAME/repos- USERNAME
- replace with the GitHub username of interest.
GitLab:
curl -s https://gitlab.com/api/v4/users/USERNAME/projects