Home / Alt manpages / gh-extension-search(1)

  • gh-extension-search(1)
  • User command
  • linux

Find the Right GitHub CLI Extension Before Installing It

Typing a repository name from memory and hoping is risky, so gh extension search gives you a repeatable way to look before you install. It lets you narrow by owner or licence, pull machine-readable fields, and decide what to install without guessing from a name. The examples use GitHub CLI 2.87.3, installed here as package gh.

Allow about ten minutes. You need gh on your PATH and a network connection to GitHub. Searching is an ordinary user operation: no sudo, nothing installed, nothing changed locally. The results are live repository data, so check the repository itself before trusting it.

1. Check the installed command

Confirm which executable and version will handle the search:

$ command -v gh
/usr/bin/gh
$ gh --version
gh version 2.87.3 (2026-02-23)

Your path and version may differ. Read the local help when a newer release changes an option:

$ gh extension search --help

Checkpoint

The command is available, and the reported version is the one you are documenting or troubleshooting. The shorter gh ext search form is also accepted and is what the manual examples use.

With no query, this prints the first 30 available extensions, sorted by star count per the manual. Run it without elevated privileges:

$ gh extension search
  • On a terminal, each row shows an installed marker, an OWNER/REPO name, and a description.
  • The marker is a tick for something already installed locally; redirected or piped output renders it as the word installed instead.
  • Do not mistake a result in this list for something installed: check local state separately with
    $ gh ext list

A long result set can distract you before you have a question in mind. Start small while exploring, then widen deliberately:

$ gh extension search --limit 10
$ gh extension search --limit 100

--limit, or -L, defaults to 30 and caps the number fetched. A larger value can take longer and gives you more to review; it does not make the results more trustworthy.

3. Search for a capability

Put a plain search term after the command. For example, extensions related to pull request workflows:

$ gh extension search pull-request --limit 20

The output is repository-oriented, not a curated package catalogue. Read each repository's description, recent activity and documentation before installing it: check the owner, licence, intended permissions and installation instructions. A similarly named repository is a candidate to investigate, not proof that it is the official project.

For a narrower search by owner, use --owner:

$ gh extension search --owner github --limit 20

Filter by a licence string when that matters to your selection:

$ gh extension search --license MIT --limit 20

These filters reduce the fetched set; they do not audit a project's source, establish that its licence suits your use, or replace your organisation's review process.

4. Make sorting explicit

The command supports forks, help-wanted-issues, stars and updated for --sort, plus --order asc or --order desc when direction matters:

$ gh extension search --sort updated --order asc --limit 20

The manual says --order is ignored unless --sort is given, and defaults to descending. The help output reports best-match as the default for --sort, while the no-argument description calls out a first-30 list sorted by stars. If ordering matters to a script or a review, pass both options explicitly rather than trust a default.

Checkpoint

You can explain why a repository appeared and reproduce the ordering with explicit flags. A star count is a popularity signal, not a security or maintenance guarantee.

5. Ask for stable fields

For a review note or a script, request JSON instead of parsing the human-readable columns, and limit the fields to what you actually need:

$ gh extension search pull-request --limit 5 \
    --json fullName,description,stargazersCount,updatedAt,url

Expect a JSON array. This installed version supports at least fullName, description, stargazersCount, updatedAt and url. The exact records will change as GitHub changes; keep the JSON output intact whenever you need an auditable candidate list.

Use --jq to reshape that JSON with a jq expression. This prints only repository names and URLs:

$ gh extension search pull-request --limit 5 \
    --json fullName,url \
    --jq '.[] | "\(.fullName) \(.url)"'

Warning

Do not pass untrusted text as a jq expression. If you need Go-template formatting instead, use --template, and check whichever format you pick against a small result set before putting it into automation.

6. Investigate a candidate before installation

Search does not install anything. Before you change your workstation, open the repository or inspect it with the normal GitHub CLI repository commands:

$ gh repo view OWNER/REPO
$ gh repo view OWNER/REPO --web

Replace OWNER/REPO with the exact value from fullName. Confirm it is the repository you intended, read its installation instructions, check recent commits and releases, and work out what the extension will execute with your GitHub credentials. Installation can run code or grant an extension access to repository data, so it is security-sensitive. Do not install a result just because it has a lot of stars.

To browse the search in a browser instead, -w or --web opens the query:

$ gh extension search pull-request --web

That opens a browser and installs nothing. In a headless shell, use JSON output instead.

7. Use repository search for finer queries

gh extension search deliberately exposes fewer qualifiers than general repository search. If it is too broad, use the topic the manual suggests:

$ gh search repos --topic gh-extension --limit 20

Use gh help search repos to check the qualifiers your installed release supports. Topic search is a discovery aid, not a guarantee that every result is a usable extension: confirm the repository's documentation and entry points before treating it as one.

Common failure checks

A network, authentication or API error is not the same as an empty search result. Capture the command and exit status, then retry once connectivity and authentication are confirmed:

$ gh extension search --limit 5
$ printf 'exit status: %s\n' "$?"
exit status: 0

A zero status means the invocation completed, not that any returned repository has been validated. If a query returns nothing useful, change the search term or use gh search repos rather than immediately widening the limit.

If the installed marker is missing from a non-interactive result, that is expected: it becomes the word installed when the command is not connected to a terminal. Use gh ext list directly to list local extensions. No recovery action is needed, because searching changes no local state.

Done means

  • Version identified: gh --version confirmed the installed CLI, 2.87.3 on the reference machine.
  • Search narrowed correctly: you can search by term, owner and licence without sudo.
  • List versus search understood: you know the difference between the search list and gh ext list.
  • Ordering made explicit: important ordering uses --sort and --order, not defaults.
  • Fields over parsing: JSON output gives you named fields without parsing display columns.
  • Trust checked separately: you inspect a repository before making the separate decision to install it.