{
  "slug": "gh-repo-read-file-and-read-dir-inspect-remote-repository-content-41a732a2ff05",
  "title": "gh repo read-file and read-dir inspect remote repository content",
  "tools": [
    "gh"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-06-17T20:03:57.000Z",
  "announced_at": "2026-06-17T20:03:57.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When using GitHub CLI v2.95.0 or later to inspect a remote repository without cloning, run `gh repo read-file <path> --repo <owner>/<repo>` to read a file or `gh repo read-dir [<path>] --repo <owner>/<repo>` to list a directory.",
    "examples": [
      "gh repo read-file <path> --repo <owner>/<repo>",
      "gh repo read-dir [<path>] --repo <owner>/<repo>",
      "gh repo read-file <path> --repo <owner>/<repo> --ref <branch|tag|commit>"
    ],
    "gotchas": [
      "Version: v2.95.0 or later",
      "Availability: Available to all GitHub users, including those on GitHub Enterprise Server (GHES).",
      "Requires Install or upgrade GitHub CLI to v2.95.0 or later.",
      "<path> (read-file) (required): Path of the file to read.",
      "[<path>] (read-dir): Directory to list; omitted means repository root.",
      "--repo <[HOST/]OWNER/REPO> (required): Select the repository to inspect.",
      "--ref <string>: Branch, tag, or commit to read or list from; default is the repository’s default branch.",
      "--output <path>: For read-file, write the file to a path instead of stdout.",
      "--clobber: For read-file, overwrite the output path if it already exists.",
      "--allow-escape-sequences: For read-file, allow printing terminal escape sequences.",
      "--json <fields>: Output JSON with selected fields.",
      "--jq <expression>: Filter JSON output using a jq expression.",
      "--template <string>: Format JSON output using a Go template.",
      "Prerequisite: Install or upgrade GitHub CLI to v2.95.0 or later for these commands.",
      "Prerequisite: Both commands are in preview and may change without notice.",
      "The commands allow exploration without cloning."
    ]
  },
  "why_it_matters": "Inspect files or browse directories in a remote repository from your terminal without cloning it.",
  "sources": [
    "https://github.blog/changelog/2026-06-17-read-remote-repository-content-with-github-cli",
    "https://cli.github.com/manual/gh_repo_read-file",
    "https://cli.github.com/manual/gh_repo_read-dir",
    "https://github.com/cli/cli/releases/tag/v2.95.0"
  ],
  "rank": 0.99064,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v1+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "recover-20261008",
    "verdict_id": "recover-20261008:recover-20261008-282151487924b949-0:gate",
    "evidence_hash": "d5eb025d019053b85b1bb6320f137d38ad15cc89b1451c84376c01c3a5e7e322"
  },
  "review": {
    "draft_hash": "92e790f973693a34000448245b88d291044b0b86f91484369652d7a5afc93c29",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "recover-20261008:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.99 >= 0.9; 2 needed) and Jev gave 0.70 (>= 0.6 needed)."
  }
}
