Agent suggestions
Public previewDescription
Describe the feature or problem you’d like to solve
--attach (on gh issue create/edit/comment and gh pr create/edit/comment) only accepts images and videos. Every other file type that GitHub accepts as an attachment in the browser is refused locally, before any request is made:
$ gh version
gh version 2.103.0 (2026-10-21)
$ gh pr comment 100 --body "Rendered mix" --attach mix.mp3
mix.mp3 is not a supported file type (supported: png, jpg, jpeg, gif, webp, svg, mp4, mov, webm)The Attaching files docs list many more types that can be attached to issue, pull request, and discussion comments, with their own size limit (25MB for "all other files"):
| Category | Extensions |
|---|---|
| Documents | .pdf, .docx, .pptx, .xlsx, .xls, .xlsm, .odt, .fodt, .ods, .fods, .odp, .fodp, .odg, .fodg, .odf, .rtf, .doc |
| Text and data | .txt, .md, .copilotmd, .csv, .tsv, .log, .json, .jsonc |
| Development and code | .c, .cs, .cpp, .css, .drawio, .dmp, .html, .htm, .java, .js, .ipynb, .patch, .php, .cpuprofile, .pdb, .py, .sh, .sql, .ts, .tsx, .xml, .yaml, .yml |
| Archives | .zip, .gz, .tgz |
| Communication and logs | .debug, .msg, .eml |
| Images | .bmp, .tif, .tiff |
| Audio | .mp3, .wav |
Common cases this blocks from the command line: attaching a log or crash dump to a bug report, a .patch or .zip reproduction, a PDF spec, or an audio file for review.
The extension allowlist was introduced in #14178, which limits it to "six image extensions and three video extensions" because those are the two kinds gh knows how to render. Audio and documents don't appear to have been considered either way.
Proposed solution
Accept every extension the docs list, with a third rendering kind next to image and video:
- Image (embed,
): unchanged..bmp,.tif, and.tiffare listed under "Additional file types" rather than "Image and media files", so they may belong with links rather than embeds; the web uploader's output for them would settle it. - Video (bare URL, rendered as a player): unchanged.
- File (link,
[filename](url)): everything else, matching what the web uploader inserts for a non-media file.--attach path=altcould either be refused (as it is for videos today) or used as the link text. - Size limits: images 10MB, videos 100MB (server enforces the 10MB free-plan limit), other files 25MB.
- Help text for the six commands and the "not a supported file type" error list the new types.
Server-side blocker. Relaxing the allowlist in gh is not enough on its own. I posted sample files directly to the endpoint gh uses (POST https://uploads.github.com/user-attachments/assets?name=...&content_type=...&repository_id=...) with an OAuth token that has write access to the repository. A .png as image/png returned an asset URL, but every non-image, non-video type I tried was refused with HTTP 422:
{
"message": "Validation Failed",
"errors": [
{"resource": "UserAsset", "field": "content_type", "message": "content_type is not included in the list of allowed content types"},
{"resource": "UserAsset", "field": "name", "message": "name has a file extension that does not match the content type: .mp3 != audio/mpeg"}
]
}I saw the same response for .mp3 (audio/mpeg, audio/mp3, application/octet-stream), .wav (audio/wav), .pdf (application/pdf, application/octet-stream), .zip (application/zip), .gz and .tgz (application/gzip), .txt and .log (text/plain), .csv (text/csv), .json (application/json), .md (text/markdown), .bmp (image/bmp), .tif and .tiff (image/tiff), .py (text/x-python), .sh (application/x-sh), .patch (text/x-diff), .yaml (application/yaml), .xml (application/xml), and .html (text/html).
So this needs the endpoint to accept the same content types as the browser uploader (or documentation of the content type it expects for each extension) before gh can support them. Once it does, the gh side is the allowlist, the link rendering kind, and the size limit above.
Additional context
- Docs: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/attaching-files
- Validation layer:
--attachstack 2/8: Describe and validate a fileghcan attach #14178 - A related gap:
gh discussion commenthas no--attach, although the docs say these types are also supported in discussion comments.
This issue was drafted with help from an AI agent. The commands and endpoint responses above were run and observed directly.
Activity
cli-triage commentedon Nov 11, 2026
GitHub CLI 2.103.3 still limits
--attachto six image extensions and three video extensions. The released client has no file attachment kind, 25 MB file limit, or downloadable-link rendering for documents, archives, audio, text, or code files. This request clearly describes that remaining gap across issue and pull request commands. The reported server-side rejection is also an important dependency: expanding the local allowlist alone would not make these uploads work until the upload endpoint accepts the documented file types and content types.Supporting reports
Duplicate analysis
Label reasoning
Investigation notes
Generated by issue triage.
babakks commentedon Nov 16, 2026
Thanks for the suggestion and investigation, @thedavidweng! 🙏
As you noted, relaxing the CLI’s file type restrictions alone is not enough: the upload API also rejects these formats. We need support in the API before we can add this functionality to
gh.I’ll keep this as an enhancementa request to improve CLI
and add
blocked
and
platform
Problems with the GitHub platform rather than the CLI client
to make that dependency clear. Once the API supports these file types, we can revisit support in the CLI.
github-actions commentedon Nov 16, 2026
Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.