Skip to main content

Command referencegh browse

gh browse command (Linux & Windows / GitHub CLI)

Linux & WindowsGitHub CLIgitbeginner

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 / optionMeaning
-b, --branchSelect a branch to browse.
-c, --commitOpen a commit.
-s, --projectsOpen projects view when available.
-n, --no-browserPrint 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.

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.