GitHub CLI Media
Use --attach on supported gh issue and gh pr commands for authorized
GitHub media uploads instead of committing the file or hosting it elsewhere.
Pair it with agent-browser when visual browser
evidence helps: capture local before-and-after screenshots or a recording, then
attach them in the same issue, pull request, or comment write.
Guardrails
- Require
gh v2.99.0 or newer and confirm the target command's help lists
--attach. Otherwise, report the required managed upgrade instead of
attempting an undocumented upload flow.
- Treat the upload as an external write. Drafting an issue, pull request, or
comment does not authorize uploading its attachments.
- Confirm the account, repository, target item, and file contents immediately
before the command. Uploads require
WRITE, MAINTAIN, or ADMIN access.
- Use only on GitHub.com or GitHub Enterprise Cloud. GitHub Enterprise Server
and GitHub App tokens are not supported.
Attach
--attach <path> works on gh issue create, gh issue edit,
gh issue comment, gh pr create, gh pr edit, and gh pr comment.
Repeat the flag for multiple files:
gh issue comment 12 --repo OWNER/REPO --body 'Reproduction:' \
--attach '/tmp/agent-browser-before.png#Before the change' \
--attach '/tmp/agent-browser-after.png#After the change'
- A matching local path in the Markdown body is rewritten to the uploaded URL
in place and keeps its existing alt text. Otherwise, attachments are appended
in flag order.
- For an image, quote
<path>#<alt text> so the shell does not treat # as a
comment. The filename is the fallback alt text. Videos do not accept alt text.
- Supported extensions are PNG, JPG/JPEG, GIF, WebP, SVG, MP4, MOV, and WebM.
One invocation accepts at most 50 attachments.
- Images and GIFs are limited to 10 MB. Video is limited to 10 MB on Free plans
and 100 MB on paid plans.
Uploads stop at the first failure. Earlier files may still be attached while
the command exits nonzero, so re-read the user-visible body or comment before
retrying. After success, verify that referenced local paths were replaced or
unreferenced media was appended, and that it renders in the intended position.
Sources: GitHub announcement,
GitHub CLI docs,
and the official gh skill.
1---2name: github-cli-media3description: Attach local images or videos to GitHub issues, pull requests, and comments with GitHub CLI's repeatable --attach flag. Use when publishing screenshots, recordings, diagrams, or rendered results from local files to GitHub.4---56# GitHub CLI Media78Use `--attach` on supported `gh issue` and `gh pr` commands for authorized9GitHub media uploads instead of committing the file or hosting it elsewhere.1011Pair it with [agent-browser](https://agent-browser.dev/) when visual browser12evidence helps: capture local before-and-after screenshots or a recording, then13attach them in the same issue, pull request, or comment write.1415## Guardrails1617- Require `gh` v2.99.0 or newer and confirm the target command's help lists18 `--attach`. Otherwise, report the required managed upgrade instead of19 attempting an undocumented upload flow.20- Treat the upload as an external write. Drafting an issue, pull request, or21 comment does not authorize uploading its attachments.22- Confirm the account, repository, target item, and file contents immediately23 before the command. Uploads require `WRITE`, `MAINTAIN`, or `ADMIN` access.24- Use only on GitHub.com or GitHub Enterprise Cloud. GitHub Enterprise Server25 and GitHub App tokens are not supported.2627## Attach2829`--attach <path>` works on `gh issue create`, `gh issue edit`,30`gh issue comment`, `gh pr create`, `gh pr edit`, and `gh pr comment`.31Repeat the flag for multiple files:3233```bash34gh issue comment 12 --repo OWNER/REPO --body 'Reproduction:' \35 --attach '/tmp/agent-browser-before.png#Before the change' \36 --attach '/tmp/agent-browser-after.png#After the change'37```3839- A matching local path in the Markdown body is rewritten to the uploaded URL40 in place and keeps its existing alt text. Otherwise, attachments are appended41 in flag order.42- For an image, quote `<path>#<alt text>` so the shell does not treat `#` as a43 comment. The filename is the fallback alt text. Videos do not accept alt text.44- Supported extensions are PNG, JPG/JPEG, GIF, WebP, SVG, MP4, MOV, and WebM.45 One invocation accepts at most 50 attachments.46- Images and GIFs are limited to 10 MB. Video is limited to 10 MB on Free plans47 and 100 MB on paid plans.4849Uploads stop at the first failure. Earlier files may still be attached while50the command exits nonzero, so re-read the user-visible body or comment before51retrying. After success, verify that referenced local paths were replaced or52unreferenced media was appended, and that it renders in the intended position.5354Sources: [GitHub announcement](https://github.blog/changelog/2026-09-01-github-cli-media-in-issues-pull-requests-and-comments/),55[GitHub CLI docs](https://docs.github.com/en/github-cli/github-cli/attaching-files-with-github-cli),56and the [official `gh` skill](https://github.com/cli/cli/blob/v2.99.0/skills/gh/SKILL.md#attaching-images-and-videos).