Command referencegh browse
gh browse command (Linux & Windows / GitHub CLI)
What it does
Open a GitHub repository, issue, pull request, or path in the browser. When people search for gh browse, they usually want practical GitHub CLI flags, safe examples, and how this subcommand fits everyday PR and repo workflows on Linux, Windows, and macOS. Syntax, options, and copyable examples are below.
Open a GitHub repository, issue, pull request, or path in the browser.
Syntax
gh browse [<number> | <path> | <commit>] [flags]
Common options
| Flag / option | Meaning |
|---|---|
| -b, --branch | Select a branch to browse. |
| -c, --commit | Open a commit. |
| -s, --projects | Open projects view when available. |
| -n, --no-browser | Print the URL instead of opening it. |
Practical examples
Open repo
gh browse
Opens the current repository on GitHub.
Open PR or issue
gh browse 123
Opens issue or pull request 123.
Open a file
gh browse README.md
Opens the file view for README.md on the default branch.
Print URL
gh browse --no-browser
Prints the URL so you can copy it into chat or docs.
Common mistakes
- Assuming browse can open private repos without authentication.
- Passing a local absolute path that does not exist in the remote tree.
Related commands
- gh repo viewDisplay metadata about a GitHub repository in the terminal or open it in a browser.
- gh pr viewDisplay pull request metadata, body, and checks in the terminal or browser.
- gh issue viewShow details for a GitHub issue in the terminal or open it on the web.
- gh release listList published GitHub releases for the repository.
- gh auth loginAuthenticate the GitHub CLI with GitHub.com or GitHub Enterprise so other gh commands can run.
- gh pr createCreate a pull request from the current branch with title, body, reviewers, and base branch options.
- gh pr mergeMerge a pull request using merge commit, squash, or rebase strategies.
- gitTrack source history and collaborate through distributed repositories.
FAQ
What does gh browse do in GitHub CLI?
Open a GitHub repository, issue, pull request, or path in the browser.
Does gh browse work on Windows and Linux?
Yes. The GitHub CLI (`gh`) runs on Linux, Windows, and macOS with the same subcommand syntax after you authenticate with `gh auth login`.
What is a practical gh browse example?
Try `gh browse` — Opens the current repository on GitHub.
Do I need a token in the command line for gh browse?
Prefer `gh auth login` so credentials stay in the system keyring or secure storage. Avoid pasting personal access tokens into shell history.
Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.