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

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

List GitHub Organisations with gh org list

Thirty rows on screen, and no clue whether that is everyone: gh org list caps its output by default. This guide shows how to raise that cap and trust the result. Allow about ten minutes, with GitHub CLI installed and an authenticated account.

Checked against the installed gh executable, version 2.87.3, released 23 February 2026; local manpage dated March 2026. The package database on this machine reports a different Ubuntu package record, so trust gh --version for the executable actually on your PATH, not the package metadata.

1. Confirm the executable and syntax

Start with checks that do not touch GitHub and need no elevated privileges:

$ command -v gh
/usr/bin/gh
$ gh --version
gh version 2.87.3 (2026-02-23)
$ gh org list --help
List organizations for the authenticated user.

Your path and version may differ. The command is gh org list, alias gh org ls. Its only command-specific option is -L or --limit, controlling the maximum returned; the default is 30.

Checkpoint

If command -v gh finds a copy you were not expecting, sort that out before troubleshooting authentication. A shell can keep an old location cached in its command hash, so start a new shell or run hash -r after fixing your PATH.

2. Check authentication before listing

gh org list lists organisations for the authenticated user and takes no username argument, so check the active login first:

$ gh auth status
github.com
  Logged in to github.com account YOUR_LOGIN (keyring)
  Active account: true

Wording and credential storage details vary by version and configuration. The checks that matter are host, account and active state. Do not paste a token, password or full credential diagnostic into a ticket or public issue.

Not logged in? Authenticate with the normal interactive flow:

$ gh auth login

Warning

This changes local credential state, so read the host and protocol prompts rather than accepting a copied command from an untrusted source. No sudo needed; on a managed workstation, use the approved credential store and account.

3. List the first 30

Run it with no options:

$ gh org list
NAME       URL
acme       https://github.com/acme
octo-lab   https://github.com/octo-lab

Rows are account-specific, so names and columns will differ for you. A successful run writes a list and exits cleanly; it is organisations visible to the authenticated account, not a directory of every organisation on GitHub, and it proves nothing about your ability to administer any of them.

Want a record for later, non-destructive comparison? Redirect to a new file rather than overwriting a report you might still need:

$ gh org list > organisations.txt
$ test -s organisations.txt && echo "saved a non-empty list"
saved a non-empty list

Treat that file as ordinary operational data, not a secret, but do not publish it blind: organisation names can themselves be sensitive.

4. Raise the limit deliberately

Default is 30. Ask for more when you have a reason to expect it:

$ gh org list --limit 100
NAME       URL
acme       https://github.com/acme
octo-lab   https://github.com/octo-lab

Short form:

$ gh org list -L 100

Tip

--limit is a maximum, not a promise. Fewer visible organisations means fewer rows, full stop. Start with a reasonable value in scripts: an unnecessarily large request just creates avoidable API work, it never reveals organisations your account cannot see.

Checkpoint

Compare the row count with the limit you set. Hit the limit exactly? Repeat with a higher value before calling the list complete. The header row is not an organisation.

5. Diagnose an empty or failed result

An empty list and an error are different animals. An empty successful result can mean the account is authenticated but genuinely belongs to no visible organisation. A non-zero exit status means the command itself did not complete.

$ gh org list --limit 100
$ status=$?
$ printf 'exit status: %s\n' "$status"
exit status: 0

Do not treat that sample status as proof of your own result: a non-zero status, an API error, or an authentication message is the evidence that matters. Rerun gh auth status, check the host is correct, and confirm the active account is the one you meant. Changed accounts recently? Authenticate again through the approved process.

On a self-hosted GitHub Enterprise Server host, authenticate to that host explicitly and repeat the check there: logging into github.com does not also authenticate you to an enterprise host.

6. Keep the boundary clear in scripts

The command has no option to select a different user, organisation or output format. For a stable record, save the plain output and note the command version alongside it:

$ {
>   gh --version
>   gh org list --limit 100
> } > organisations-with-version.txt
$ sed -n '1,5p' organisations-with-version.txt

Quote file paths that come from variables, check the exit status, and never turn organisation names into shell code. The command only reads visibility through the GitHub CLI API; it changes no membership, permission, repository or local Git configuration.

There is no undo step for the listing itself, since listing is read-only. If you redirected output to a file, remove it only once you know it is no longer needed and holds nothing subject to your retention rules.

Done means

  • Executable and contract checked. gh --version and gh org list --help matched what you expected.
  • Account confirmed. gh auth status showed the intended host and active account, no credentials exposed.
  • Organisations listed, or an honest empty recorded. Not silently assumed either way.
  • Limit raised when 30 was not enough. Treated throughout as a maximum, not a target.
  • Failures diagnosed properly. Exit status and auth context checked, nothing guessed from a blank screen.
  • Nothing changed. No organisation membership, permission, repository or service state touched.