>_ ghcli.com
ghcli / Repositories / gh repo view

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.

Quick answer
gh repo view cli/cli

Syntax

gh repo view [<repository>] [flags]

Examples

View the current repository

gh repo view

View any public repo by name

gh repo view cli/cli

Open the repo in the browser

gh repo view cli/cli --web

Show the README of a specific branch

gh repo view cli/cli --branch trunk

Pull metadata as JSON

gh repo view cli/cli --json stargazerCount,description,licenseInfo

Options & flags

FlagWhat it does
-w, --webOpen the repository in the browser.
-b, --branchView a specific branch of the repository.
--jsonOutput specified fields as JSON.
-q, --jqFilter JSON output with a jq expression.

How to use gh repo view, step by step

  1. Run gh repo view owner/name to render the README inline.
  2. Add --branch to preview a non-default branch.
  3. Use --web to jump to the full page.
  4. Script with --json to 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.