GitHub CLI: Media in issues, pull requests, and comments 🚀 #205787
Replies: 4 comments 2 replies
|
When will gh 2.99 be added to brew repositories? |
|
Will this be supported via API as well? |
|
Would be great to see this capability added to the GitHub MCP server too, so that Claude Code on the web can attach screenshots to pull requests etc. Claude Code on the web uses the GitHub MCP server rather than the gh cli. |
It would be great if user access tokens Context: I'm developing CLI to create user access tokens for secure local development, but unfortunately, we can't upload files using user access tokens. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
GitHub CLI now has a repeatable
--attachflag that uploads a local image or video and references it inline in an issue, pull request, or comment body.This is now generally available to all users on GitHub across all plans. You just need to update
ghto v2.99.0.Why this matters
Some things are easier to show than to describe (i.e., a UI bug, a rendered result, an error on screen). Previously,
ghonly wrote text, so adding an image or video to an issue or pull request meant stopping to open the browser, drag the file into the comment box, and copy the result back. Now,ghcan attach images and videos directly from the command line.--attachputs the image in the same command that writes Markdown. File the bug, and the screenshot lands with it, so the issue shows the actual problem the first time. Open the pull request with a before and after, and the reviewer sees the change instead of pulling the branch to check. Your coding agents get this too, so they can show a result rather than describe it.Capabilities
--attachis repeatable and works ongh issue create,gh issue edit,gh issue comment,gh pr create,gh pr edit, andgh pr comment.keeps its alt text and becomes the uploaded asset. Anything attached but never referenced is appended at the end.#, as in--attach './login.png#The login error state'. Omit it andghfalls back to the filename.Security and access controls
Uploads authenticate with the common token types
ghalready uses, either the OAuth token fromgh auth loginor a classic personal access token. Write access to the repository you are attaching to is required for image uploading.--attachis generally available to all users on GitHub across all plans, with no preview period. Size limits match the web upload flow: 10 MB for images and GIFs, 10 MB for video on Free plans, and 100 MB for video on paid plans. GitHub Enterprise Server is not supported in this release.Getting started
Update
ghto v2.99.0, then rungh issue comment <number> --attach ./screenshot.png.--attachworks the same way ongh issueandgh prcreate, edit, and comment. Rungh help <command>for the full flag reference.Read the docs to learn more about attaching files from the command line.
🌟 Leave a comment!
Join the discussion and leave feedback in the comments below!
All reactions