Home / Alt manpages / gh-repo-list(1)

  • gh-repo-list(1)
  • User command
  • linux

List GitHub Repositories with gh repo list

An organisation with 400 repositories will quietly show you 30 of them and let you assume that is everything. gh repo list is how you check what actually exists, filter it properly, and get JSON your scripts can trust. Allow about ten minutes.

  • You need: the gh package, a working GitHub CLI authentication session, and permission to see the repositories you want to list.

1. Confirm the installed command

This guide was checked against GitHub CLI 2.87.3, installed on 23 September 2026. Package versions drift, so check your own binary before trusting a flag in a script.

$ gh --version
gh version 2.87.3 (2026-02-23)
$ gh repo list --help

The local manual describes gh repo list [<owner>] [flags]; gh repo ls is an alias shown by the command help.

Checkpoint

The version is printed and the help lists the flags you plan to use. If gh is missing, install GitHub CLI through your normal package-management process. Do not add sudo to the listing command merely because a repository is private.

2. List repositories for the current account

With no owner argument, gh repo list lists repositories owned by the authenticated user. The default maximum is 30, so this is a preview, not necessarily the full inventory.

$ gh repo list --limit 10
NAME                  DESCRIPTION                 VISIBILITY  UPDATED
example/project       Example project             public      about 2 hours ago
example/internal-tool  Internal tooling            private     about 1 day ago

Treat the names and timestamps above as illustrative output, not values to copy; they depend on the installed version and the repositories returned. To inspect a particular organisation or user, put its exact login in the owner position:

$ gh repo list EXAMPLE_ORG --limit 100

The owner boundary matters here. The command lists repositories owned by the supplied argument; it does not search member accounts for repositories that happen to be forks of organisation repositories.

3. Choose the repository set explicitly

  • --limit accepts an integer and defaults to 30. A value such as 1000 requests up to that many repositories; it is not a guarantee the account holds that number or that your permissions expose all of them.
  • --no-archived omits archived repositories. Use --archived instead if you only want archived ones.
  • --fork keeps only forks, while --source keeps only non-forks.
  • --language Python, --topic security, --visibility private filter by metadata. Visibility accepts public, private or internal. None of these change a repository, its topics or its archive state.
$ gh repo list EXAMPLE_ORG --limit 1000 --no-archived
$ gh repo list EXAMPLE_ORG --limit 100 --source --no-archived
$ gh repo list EXAMPLE_ORG --limit 100 --fork --archived

4. Request stable fields for scripts

Human-oriented columns are convenient at a terminal but a poor interface for automation. Ask for named JSON fields instead: the installed command lists fields such as nameWithOwner, description, isArchived, isFork, primaryLanguage, updatedAt, url and visibility.

$ gh repo list EXAMPLE_ORG --limit 100 --no-archived \
    --json nameWithOwner,visibility,isFork,updatedAt
[
  {
    "isFork": false,
    "nameWithOwner": "EXAMPLE_ORG/project",
    "updatedAt": "2026-09-22T14:30:00Z",
    "visibility": "PUBLIC"
  }
]

JSON output is fine to save to a new file. Do not overwrite an existing inventory until the command has succeeded and the content has been checked:

$ gh repo list EXAMPLE_ORG --limit 1000 --json nameWithOwner,visibility \
    > repositories.json.new
$ jq 'length' repositories.json.new
1
$ mv repositories.json.new repositories.json

The final mv replaces the old inventory. If the command fails, remove repositories.json.new and the original file is still there.

Warning

Do not run rm repositories.json as part of recovery. That deletion is unnecessary and irreversible; deleting the good file to fix a bad one is the wrong direction.

5. Select a small result with jq

The --jq flag applies a jq expression straight to the JSON output, so a separate jq process is not needed for a simple report:

$ gh repo list EXAMPLE_ORG --limit 1000 \
    --json nameWithOwner,visibility \
    --jq '.[] | [.nameWithOwner, .visibility] | @tsv'
EXAMPLE_ORG/project	PUBLIC

Tip

For more elaborate shaping, keep the raw JSON in a temporary file and validate it before handing it to another program. A typo in a field name or jq expression should stop the pipeline, not silently produce a misleading report.

6. Diagnose empty or incomplete results

  • Check the owner spelling and the limit first. Then compare a human listing with a JSON listing using the same filters.
  • An empty result can be correct. The visibility, topic, language or fork state may simply not match anything.
  • An organisation listing cannot cross the ownership boundary. It will never surface a member's personal fork of an organisation repository.
$ gh repo list EXAMPLE_ORG --limit 5 --json nameWithOwner
$ gh repo list EXAMPLE_ORG --limit 5 --visibility private --json nameWithOwner

If the command reports an authentication or permission error, fix the GitHub CLI session and access rights before changing filters. Do not put a token in the command line, shell history or an output file. Repository descriptions can contain arbitrary text, so quote values when passing them to another shell command and prefer JSON parsing over whitespace splitting.

Done means

  • You confirmed the installed gh version and read the matching help.
  • You supplied an owner and an explicit limit when a complete inventory mattered.
  • You chose archive and fork filters deliberately instead of assuming their defaults.
  • You used --json and, where useful, --jq for automation.
  • You staged a replacement inventory through a new file and kept the previous file recoverable until verification.