Skip to main content

Command referencegh repo view

gh repo view command (Linux & Windows / GitHub CLI)

Linux & WindowsGitHub CLIgitbeginner

What it does

Display metadata about a GitHub repository in the terminal or open it in a browser. When people search for gh repo view, 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.

Display metadata about a GitHub repository in the terminal or open it in a browser.

Syntax

gh repo view [<repository>] [flags]

Common options

Flag / optionMeaning
-w, --webOpen the repository in a browser.
--jsonSelect fields for machine-readable output.
-b, --branchView a specific branch when supported by the view.

Practical examples

View current repo

gh repo view

Shows description, visibility, and defaults for the current git repo.

Open in browser

gh repo view -w

Opens the GitHub repository page.

Another repo

gh repo view cli/cli

Views a repository without cloning it.

Common mistakes

  • Running outside a git repo without passing OWNER/REPO.
  • Expecting `--json` without field names to print a full dump on every gh version.

FAQ

What does gh repo view do in GitHub CLI?

Display metadata about a GitHub repository in the terminal or open it in a browser.

Does gh repo view 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 repo view example?

Try `gh repo view` — Shows description, visibility, and defaults for the current git repo.

Do I need a token in the command line for gh repo view?

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.