Explore repository content from your terminal without cloning by using two new commands: gh repo read-file and
.
gh repo read-dir
- Use
gh repo read-file
to read an individual file from a remote repository - Use
gh repo read-dir
to browse a directory’s contents from a remote repository
These commands work across public and private repositories you have access to, making it faster to inspect code, documentation, and configuration files from any repository.
Use cases
With gh repo read-file
and gh repo read-dir
, you can:
- Quickly inspect README files or documentation without leaving your terminal.
- Check configuration files across multiple repositories.
- Build scripts and automation that read repository content.
- Integrate repository exploration into AI agents and workflows.
Availability
gh repo read-file
and gh repo read-dir
are available to all GitHub users, including those on GitHub Enterprise Server (GHES), after installing or upgrading to GitHub CLI v2.95.0 or later. You can also teach your agents how to leverage new GitHub CLI features by installing or updating the gh skill.
Learn more or give us feedback on the cli/cli repository.