gh repo view
Read a repo's README and stats in-terminal
gh repo view renders a repository's README, description, and key stats directly in your terminal. Point it at any owner/name to preview a project before cloning, or add --web to open it on github.com.
gh repo view cli/cliSyntax
gh repo view [<repository>] [flags]Examples
View the current repository
gh repo viewView any public repo by name
gh repo view cli/cliOpen the repo in the browser
gh repo view cli/cli --webShow the README of a specific branch
gh repo view cli/cli --branch trunkPull metadata as JSON
gh repo view cli/cli --json stargazerCount,description,licenseInfoOptions & flags
| Flag | What it does |
|---|---|
| -w, --web | Open the repository in the browser. |
| -b, --branch | View a specific branch of the repository. |
| --json | Output specified fields as JSON. |
| -q, --jq | Filter JSON output with a jq expression. |
How to use gh repo view, step by step
- Run
gh repo view owner/nameto render the README inline. - Add
--branchto preview a non-default branch. - Use
--webto jump to the full page. - Script with
--jsonto pull stars, license, or topics.
Common errors and fixes
could not resolve to a Repository with the name
Double-check the owner/name spelling and your access to the repo.
no git remotes found
You're not inside a repo and didn't name one. Pass an explicit owner/name.
Related commands
Frequently asked questions
How do I view a repository from the terminal?
Run gh repo view owner/name to render the README and details inline, or just gh repo view inside a cloned repo. Add --web to open it in the browser.
Can gh repo view show a specific branch?
Yes. Use --branch: gh repo view cli/cli --branch trunk renders that branch's README instead of the default.
How do I get repository stats as JSON?
Add --json with fields like stargazerCount, description, or licenseInfo, then filter with --jq for scripts and dashboards.