| name | github-attachments |
| description | Upload images and files to GitHub PRs, issues, and comments so GitHub hosts them instead of committing binaries to the repository. Use when adding screenshots to a PR or issue body, replacing committed screenshots or raw.githubusercontent.com links with hosted attachments, or when `gh` appears to offer no way to attach a file. |
GitHub Attachments Without Committing Binaries
Screenshots attached to a PR are review ephemera. Committing them puts
binaries in git history forever — bloating every clone, with no value to the
codebase. The historical workaround (commit the image, link it via a
raw.githubusercontent.com URL pinned to a SHA) is the anti-pattern this
skill replaces.
gh has no attachment support: no flag on gh pr create, gh pr edit,
gh issue create, or gh issue comment. The GraphQL API has no upload
mutation. But an undocumented endpoint produces exactly the
https://github.com/user-attachments/assets/<uuid> URLs that browser
drag-and-drop produces, and it works from curl with a gh token.
This endpoint is undocumented and unofficial. GitHub could change or
remove it without notice. Verified working against github.com on
2026-08-04.
Upload one file
FILE=screenshot.png
REPO_ID=$(gh api repos/OWNER/REPO --jq .id)
TOKEN=$(gh auth token)
curl -sS -X POST \
"https://uploads.github.com/user-attachments/assets?name=$(basename "$FILE")&content_type=image/png&repository_id=$REPO_ID" \
-H "Authorization: Bearer $TOKEN" \
-H \
--data-binary