gh issue, pr, and comment commands attach media with --attach
Introduced 2026-09-01 · score 0.99
HOW TO USE IT
When creating or editing an issue or pull request, or adding a comment, use repeatable `--attach <file>` to upload local images or videos and add them to the body. Include optional image alt text after `#`; an existing body reference to the file is rewritten to the uploaded asset URL, otherwise the attachment is appended.
gh issue create --attach './repro.png#The error state'gh issue edit <issue-number> --attach ./walkthrough.mp4gh pr comment <number|url|branch> --attach ./result.mp4WHY THIS HELPS
Attach local images or videos while creating or editing an issue or pull request, or adding a comment.
REQUIREMENTS AND LIMITATIONS
- Version: v2.99.0
- Availability: Attachments are available on GitHub.com and GitHub Enterprise Cloud.
- --attach <file>: Image or video file to attach, optionally as `<file>#<image alt text>`; repeat the flag for multiple files. Up to 50 files per command.
- issue number or URL (required): Selects the issue to edit or comment on.
- number, URL, or branch: Selects the pull request to comment on; without one, the current branch's pull request is used.
- <file>#<image alt text>: Optional image alt text follows `#`; without it, the filename is used. Video has no alt text.
- Prerequisite: Attachments are supported on GitHub.com and GitHub Enterprise Cloud, per the v2.99.0 release note.
- Prerequisite: The local file must be an attachable image or video; the command documentation limits attachments to images and videos.
- The repeatable `--attach` flag uploads local images and videos.
FIRST-PARTY EVIDENCE
- https://github.com/cli/cli/releases/tag/v2.99.0
- https://cli.github.com/manual/gh_issue_create
- https://cli.github.com/manual/gh_issue_edit
- https://cli.github.com/manual/gh_pr_comment
Check the installed version and the source before using it. Entry JSON