Skip to content
13256

13256

github.com • September 30, 2026

Today gh has no first-party way to attach a local image file to an issue/PR body such that the image renders inline . For public repos, a contributor can work around this by pushing the file to the repo and embedding a raw.githubusercontent.com URL, but for private repos this path fails — GitHub's camo proxy cannot authenticate to private content, so raw.githubusercontent.com/ / / / .png renders as a broken image icon in every .

The only URL GitHub renders inline regardless of repo visibility is the one produced by the web-UI drag-drop upload flow: . Every gh -accessible alternative is blocked:

gh gist create file.png → failed to collect files for posting: failed to upload ...: binary file not supported .

gh api + POST with a PAT → HTTP 422 (endpoint is web-UI only, requires user_session cookie, not token auth).

Third-party extensions like enthus-appdev/gh-attach → no windows-amd64 binary and still rely on browser session cookies rather than gh auth token .

gh release upload → asset URLs for private repos require auth and don't render via camo.

The only path we could make work for a private-repo screenshot was: launch Playwright, sign in to github.com interactively, inject a helper , populate it via the file chooser, and dispatch a drop event with a DataTransfer at the edit textarea so the web UI's own upload handler runs. That's a 10-step browser hack an agent or CI pipeline shouldn't need to reinvent.

Add a first-party flag or subcommand that uploads a local file to GitHub's user-attachments CDN and returns the resulting URL. Shape options:

A standalone command:

Or folded into the existing / create commands:

Works uniformly for public and private repos (same CDN URL shape).

Unblocks CI pipelines, bots, and gh -driven agent tooling that want to attach screenshots to .

Removes the per-team reinvention of cookie-based workarounds.

Brings parity with the web-UI drag-drop flow users already know.

Implementation notes:

If the underlying HTTP endpoint ( /upload/policies/assets or its successor) doesn't accept PAT/OAuth today, this likely needs a new REST/GraphQL surface on the GitHub API side first. If that's the real blocker, labeling this as an API dependency would at least tell users where the ask should move.

Token scope should stay minimal — image upload tied to a specific repo context is sufficient.

Real-world trigger: an automated agent was asked to include a Playwright screenshot in a private-repo issue . After exhausting raw.githubusercontent.com , gh gist create , the /upload/policies/assets endpoint, and the third-party gh-attach extension (no Windows binary), the only working path was to drive a full signed-in browser session through Playwright and hand-dispatch drop events. A first-party gh surface that returns a user-attachments URL would collapse that to a single command.

I'm very excited to say that today, you can use a preview build of gh to upload images and video. This can be used right now, by users on all plans, on GitHub.com and GitHub Enterprise Cloud with data residency. Feedback If you try out the preview and this works for you, or doesn't 😢, please let us know! Usage In its simplest form, you can use --attach to append an image: gh issue 87 --repo monalisa/monas-cafe --body " error below: " --attach ./ -error.png If you want control over placement, provide a markdown body that contains links to local files, and include those same files in --attach . Write the body with ordinary markdown image references pointing at the local files, …

I'm very excited to say that today, you can use a preview build of gh to upload images and video. This can be used right now, by users on all plans, on GitHub.com and GitHub Enterprise Cloud with data residency.

If you try out the preview and this works for you, or doesn't 😢, please let us know!

In its simplest form, you can use --attach to append an image:

If you want control over placement, provide a markdown body that contains links to local files, and include those same files in --attach .

Write the body with ordinary markdown image references pointing at the local files, …