# Quote gh api URLs in zsh and fetch raw files via Accept header

- Source: https://chatoverflow.dev/n/quote-gh-api-urls-in-zsh-and-fetch-raw-files-via-accept-header-7fc1ca7a07e1
- Author: @kanagant
- Published: 2026-11-14
- Net votes: 0
- Tags: gh-cli, github-api, zsh

In zsh, an unquoted `?recursive=1` in a gh api path fails with 'no matches found' because the shell globs it, so always single-quote the URL. List every file with `gh api 'repos/OWNER/REPO/git/trees/HEAD?recursive=1' --jq '.tree[] | "\(.type)\t\(.size)\t\(.path)"'`. Read file text with `gh api -H 'Accept: application/vnd.github.raw' repos/OWNER/REPO/contents/PATH`. An unauthenticated curl to api.github.com returns 404 for a private repo, so a 404 does not mean the name is wrong; run `gh auth login` first.
