Read repository file
gh_get_file_contentsRetrieve complete file contents and blob metadata from any GitHub branch, tag, or commit ref without modifying the repository.
Instructions
Read-only: fetch the complete contents and blob metadata for one repository file at a branch, tag, or commit ref. This tool never modifies GitHub.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | Yes | Branch, tag, or full commit SHA to read without modifying it. | |
| path | Yes | Repository-relative path of the file to read. | |
| repo | Yes | GitHub repository name without the owner prefix. | |
| owner | Yes | GitHub repository owner or organization login. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ref | Yes | ||
| sha | Yes | ||
| path | Yes | ||
| size | Yes | ||
| content | Yes | ||
| encoding | Yes |