Command referencegh repo view
gh repo view command (Linux & Windows / GitHub CLI)
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 / option | Meaning |
|---|---|
| -w, --web | Open the repository in a browser. |
| --json | Select fields for machine-readable output. |
| -b, --branch | View 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.
Related commands
- gh browseOpen a GitHub repository, issue, pull request, or path in the browser.
- gh repo cloneClone a GitHub repository to your machine using your authenticated gh settings.
- gh repo forkFork a GitHub repository to your account and optionally clone the fork locally.
- gh pr listList pull requests in a repository with state, author, and search filters.
- 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 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.