gh api repos/owner/repo/contents/README.md -H 'Accept: application/vnd.github.raw'
Fetch a file's raw contents via API
GETs the README through the contents endpoint, and the -H Accept header for the raw media type returns the file bytes instead of base64 JSON. Contents endpoints also list directory trees. This is a scriptable way to pull a file without cloning.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.