Skip to content

gh-search cannot strip repo url prefix #13862

Closed

Agent suggestions

Public preview

Description

@A4-Tacks

Describe the bug

The -R of gh search code does not support repo url, but only supports OWNER/REPO format

Affected version

gh version 2.93.0 (2026-05-28)
https://github.com/cli/cli/releases/tag/v2.93.0

Steps to reproduce the behavior

  1. Run commands in log

Expected vs actual behavior

Expect both commands to output results

Logs

$ gh search code -R https://github.com/cli/cli catch-all
no code results matched your search
$ gh search code -R cli/cli catch-all

Showing 1 of 1 results

cli/cli internal/run/stub.go

Activity

  1. cli-triage commented on Jul 13, 2026

    @cli-triage

    This looks like a bug: the -R flag for gh search code silently returns no results when given a full GitHub URL (e.g., https://github.com/cli/cli) instead of either stripping the URL to OWNER/REPO or returning a clear error. No duplicate issues were found. I'm suggesting bug and priority-3 — it's a real defect but a workaround exists (use OWNER/REPO format directly).

    Generated by Issue Triage (skills-driven) for #13862 · 16.9 AIC · ⌖ 5.46 AIC · ⊞ 5.1K · ◷

  2. BagToad commented on Jul 20, 2026

    @BagToad
    Member

    Thanks for the issue!

    This is expected because the -R/--repo flag on gh search isn't the same flag as the -R on repo-scoped commands like gh issue list or gh pr view. On those commands, -R selects a single base repository and accepts a few forms, including a full URL, which gets parsed down to OWNER/REPO.

    On gh search, --repo is a repository filter that can take multiple values and passes them straight through to GitHub's search syntax as repo:OWNER/REPO. That qualifier only understands the OWNER/REPO form, so -R https://github.com/cli/cli becomes repo:https://github.com/cli/cli and matches nothing.

    So the behavior is working as intended, but the flag's help text didn't make the expected format clear. I've opened #13922 to add an OWNER/REPO format hint to the --repo flag help across the gh search commands. In the meantime, use the OWNER/REPO form (-R cli/cli). Thanks for surfacing it!

  3. added
    gh-searchrelating to the gh search command
    enhancementa request to improve CLI
    and removed on Jul 20, 2026
  4. github-actions commented on Jul 20, 2026

    @github-actions
    Contributor

    Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.

    Unless you see the help wanted Contributions welcome label, we are not currently looking for external contributions for this feature.

    If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.

  5. BagToad commented on Jul 20, 2026

    @BagToad
    Member

    Fixed by #13922

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsenhancementa request to improve CLIgh-searchrelating to the gh search command

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions