Repository navigation
Description
problem
there is no way to attach images or files to issues or comments via gh. this has been requested multiple times (#1895, #3348, #4228, #4465) and closed as blocked on the platform api. but the world has changed — ai coding agents (claude code, codex, gemini cli, etc.) now create and manage github issues programmatically via gh, and they cannot attach screenshots, logs, or any binary content.
this is the single biggest gap in gh's agentic usability. an agent can write a perfect issue body but can't attach the screenshot that makes it actionable.
proposed ux
flag: --attach
# attach image to a new issue
gh issue create --title "ui bug" --body "see screenshot below" \
--attach screenshot.png
# attach multiple files
gh issue create --title "crash report" --body "details attached" \
--attach screenshot.png --attach crash.log
# attach image to a comment
gh issue comment 42 --body "here's the fix result" \
--attach after.png
# attach to pr body
gh pr create --title "fix layout" --body "before/after comparison" \
--attach before.png --attach after.pngthe cli would:
- upload the file (mechanism below)
- append
(for images) or[filename](uploaded-url)(for other files) to the bottom of the body - create the issue/comment with the final markdown
flag: --attach-inline
for users who want to control placement:
gh issue create --title "bug" \
--body "before:  after: " \
--attach before.png --attach after.pngthe cli replaces attach:filename references in the body with the uploaded urls.
implementation options
the api gap is real, but there are viable paths:
option 1: release asset piggyback (works today)
upload files as assets on a hidden/dedicated release, then embed the download urls in the issue body. gh release upload already works — this just chains two existing capabilities.
gh release create _attachments --repo owner/repo --notes "" 2>/dev/null
gh release upload _attachments screenshot.png --repo owner/repo
# → returns download url, embed in issue body
pros: uses public api only, no browser automation
cons: clutters releases (could use a dedicated _gh-attachments tag)
option 2: repo content upload
push files to an orphan gh-attachments branch, reference raw.githubusercontent.com urls.
pros: public api, files live in the repo
cons: bloats repo history, may hit size limits
option 3: platform api advocacy
github's internal upload endpoint (uploads.github.com/upload/policies/assets) works in the web ui via session auth. this could be exposed as a first-party api with pat/oauth support. gh is the official cli — if any tool should drive this api addition, it's this one.
option 4: hybrid (recommended)
implement option 1 as the default (works immediately), while advocating for a proper platform api (option 3) as the long-term solution. when the api lands, swap the implementation transparently — the --attach flag ux stays the same.
why now
the previous requests (#1895 in 2020, #4465 in 2021) were closed when gh was primarily a human-facing cli. today:
- ai agents create issues via
gh— claude code, codex, and other coding agents usegh issue createandgh pr createas their primary github interface. they frequently need to attach screenshots, error logs, or generated diagrams. ghis the agentic interface to github — as more development workflows become agent-driven,ghis becoming the programmatic bridge. attachments are table-stakes for this use case.- workarounds exist but aren't discoverable —
gh-attachextension uses playwright browser automation, which is brittle and heavy. a first-party solution would be far more reliable.
existing context
| issue | year | status | ask |
|---|---|---|---|
| #1895 | 2020 | closed | upload + embed files |
| #3348 | 2021 | closed | --attach flag on issue create |
| #4228 | 2021 | closed | gh image upload subcommand |
| #4465 | 2021 | closed | file attachments on comments |
| #9046 | 2024 | open | download attachments (inverse) |
all closed as "blocked on platform api" — but option 1 (release asset piggyback) doesn't need a new api. it works today with existing gh capabilities, just needs to be wired together behind a --attach flag.
Activity
[-]support image/file attachments in and (critical for agentic workflows)[/-][+]support image/file attachments in gh issue create and gh issue comment (critical for agentic workflows)[/+]BagToad commentedon Mar 18, 2026
Hey @yigitkonur, thanks for the bump on this.
The situation is still the same as in #1895 & the other issues where we don't have an API.
I don't see us doing these other techniques. They're a bit hacky and can cause problems at scale; using releases and branches for things like this have known limitations. Maintaining these fragile things are not desirable.
If there's an API for this, we'll support it. But until then, please open a community post and/or support ticket to forward your request to platform teams for enhanced visibility into your request.
Since this is a duplicate, I'm going to close it as such for now, but let us know if we missed something.
Initial release: gitshot v0.1.0
Initial release: gitshot v0.1.0
Initial release: gitshot v0.0.1
Initial release: gitshot v0.0.1
Initial release: gitshot v0.0.1
drogers0 commentedon Mar 27, 2026
I built
gh-imageas aghCLI extension to solve this. It replicates the browser's own upload flow, so images land atgithub.com/user-attachments/assets/….The same URLs you get from drag-and-drop. Images on private repos stay private, since the URLs inherit repo visibility.
^ That's the command I used to post this.
It automatically pulls your browser's session cookie, no tokens or OAuth setup required.
Surface gh image tip when agents create PRs or issues
fix(prove): route media by extension and repo visibility