GH-SEARCH-REPOS(1)

πŸ’… GH-SEARCH-REPOS(1) β€” like, the GitHub CLI manual, but make it make sense

okay bestie, welcome to gh-search-repos from the GitHub CLI manual β€” this is the page where we learn how to go find repositories on GitHub like the main character we are πŸ”βœ¨


✨ NAME ✨

gh-search-repos β€” search for repositories, fr fr 🫢


πŸŽ€ SYNOPSIS πŸŽ€

gh search repos [<query>] [flags]

that's it. that's the whole vibe. <query> is optional, flags are optional, chaos is optional but encouraged πŸ’–


🌸 DESCRIPTION 🌸

So you wanna search for repositories on GitHub. Iconic. Slay. Let's go πŸ¦‹

This command is lowkey flexible: you can build your query using the GitHub search syntax, you can use the parameter and qualifier flags, or β€” and this is the fun part β€” you can mix both. Combination queen behavior πŸ‘‘

The GitHub search syntax is documented right here, and yes you should read it, it's giving homework but the useful kind:

⟨https://docs.github.com/search-github/searching-on-github/searching-for-repositories⟩

And heads up: if your search query has a hyphen in it and you're like "why is this being weird 😭", run gh search --help for the deets on handling search queries containing a hyphen. Not me almost losing my mind over a dumb little dash πŸ’€


πŸ’… OPTIONS πŸ’…

  • --archived β€” filter based on the repository archived state, and it takes {true|false} πŸ—‚οΈ
  • --created <date> β€” filter based on the created at date πŸ—“οΈ
  • --followers <number> β€” filter based on how many followers the repo owner has πŸ‘€
  • --forks <number> β€” filter on the number of forks 🍴
  • --good-first-issues <number> β€” filter on how many issues carry the 'good first issue' label β€” perfect for your first contribution era 🌱
  • --help-wanted-issues <number> β€” filter on how many issues carry the 'help wanted' label πŸ™‹β€β™€οΈ
  • --include-forks <string> β€” include forks in the fetched repositories: {false|true|only} 🍴
  • -q, --jq <expression> β€” filter JSON output using a jq expression, chef's kiss for pipelines πŸ§‘β€πŸ³
  • --json <fields> β€” output JSON with the specified fields (peep the list further down πŸ‘‡)
  • --language <string> β€” filter based on the coding language πŸ’»
  • --license <strings> β€” filter based on license type πŸ“œ
  • -L, --limit <int> (default 30) β€” maximum number of repositories to fetch 🚦
  • --match <strings> β€” restrict the search to a specific field of the repository: {name|description|readme} 🎯
  • --number-topics <number> β€” filter on the number of topics 🏷️
  • --order <string> (default "desc") β€” order of repositories returned, and ngl it's ignored unless the '--sort' flag is specified: {asc|desc} ⬆️⬇️
  • --owner <strings> β€” filter on owner πŸ‘€
  • --size <string> β€” filter on a size range, in kilobytes πŸ“¦
  • --sort <string> (default "best-match") β€” sort the fetched repositories: {forks|help-wanted-issues|stars|updated} πŸ”₯
  • --stars <number> β€” filter on the number of stars ⭐
  • -t, --template <string> β€” format JSON output using a Go template; see "gh help formatting" 🎨
  • --topic <strings> β€” filter on topic 🧡
  • --updated <date> β€” filter on the last updated at date πŸ”„
  • --visibility <strings> β€” filter based on visibility: {public|private|internal} πŸ•΅οΈβ€β™€οΈ
  • -w, --web β€” open the search query in the web browser, chaos mode activated 🌐

🌈 JSON FIELDS 🌈

If you're passing --json <fields>, these are the ones that exist, and yes I'm listing all of them because we don't do half-finished over here πŸ’–

createdAt, defaultBranch, description, forksCount, fullName, hasDownloads, hasIssues, hasPages, hasProjects, hasWiki, homepage, id, isArchived, isDisabled, isFork, isPrivate, language, license, name, openIssuesCount, owner, pushedAt, size, stargazersCount, updatedAt, url, visibility, watchersCount


🧚 EXIT CODES 🧚

  • 0: successful execution β€” we ate 🍽️
  • 1: error β€” it's giving oops 😭
  • 2: command canceled
  • 4: authentication required β€” log in bestie πŸ”
NOTE: specific commands may have additional exit codes. Refer to the command's help for more information. No cap, always check πŸ’€

⭐ EXAMPLE ⭐

# Search repositories matching set of keywords "cli" and "shell"
$ gh search repos cli shell

# Search repositories matching phrase "vim plugin"
$ gh search repos "vim plugin"

# Search repositories using raw search qualifiers as separate arguments
$ gh search repos topic:github 'stars:>5000'

# Search repositories public repos in the microsoft organization
$ gh search repos --owner=microsoft --visibility=public

# Search repositories with a set of topics
$ gh search repos --topic=unix,terminal

# Search repositories by coding language and number of good first issues
$ gh search repos --language=go --good-first-issues=">=10"

# Search repositories without topic "linux"
$ gh search repos -- -topic:linux

# Search repositories excluding archived repositories
$ gh search repos --archived=false

not the -- -topic:linux with the double dash… the way that hyphen handling haunts us 🫠 iykyk


πŸ‘‘ SEE ALSO πŸ‘‘

gh-search(1) β€” go read the parent page too, it's the whole family 🫢


okay that's the page!! this was GitHub CLI v2.102.0, dated Oct 2026, and honestly? iconic of them. mwah πŸ’‹πŸŒΈ go search some repos bestie, you're gonna slay βœ¨πŸ’œ

πŸ“¦ where this page comes from