Skip to content

gh {pr,issue} comment file attachements #4465

Closed

Description

@austince

Describe the feature or problem you’d like to solve

Often attaching files to comments is helpful. It would be great to be able to do this from the CLI.

Proposed solution

Like gh pr create, we could have a What's next? section that allows attaching local file, as well as a flag.

The CLI may actually be able to provide a better experience than the web UI, which can only handle a certain number of file extensions. If a file extension is not supported, the CLI could quickly zip it up and attach it transparently.

Details Currently Supported: GIF, JPEG, JPG, MOV, MP4, PNG, CSV, DOCX, FODG, FODP, FODS, FODT, GZ, LOG, MD, ODF, ODG, ODP, ODS, ODT, PDF, PPTX, TXT, XLS, XLSX or ZIP.

Powerpoint but not JSON??

Activity

  1. added
    enhancement
    on Oct 8, 2021
  2. changed the title [-]`gh pr comment` file attachements[/-] [+]`gh {pr,issue} comment` file attachements[/+] on Oct 8, 2021
  3. mislav commented on Oct 11, 2021

    @mislav
    Contributor

    Hi, this request comes up every once in a while #1895 (comment) and while it's certainly an interesting feature proposal, currently we're blocked on allowing it because there is no available API to use to upload attachments to issue threads.

  4. austince commented on Oct 11, 2021

    @austince
    Author

    Ah sorry for not doing a more thorough search @mislav, will close now.

  5. rcoenen commented on Aug 22, 2025

    @rcoenen

    👍 Strongly support this feature request!

    Real-world scenario: Just tried to create a bug report with a mobile screenshot using gh issue create and had to fall back to the web interface specifically for image attachment. This breaks the seamless CLI experience.

    Benefits:

    • Keeps entire workflow in terminal
    • Essential for bug reports with visual evidence
    • Matches user expectations (most CLI tools support file operations)
    • Would improve adoption of GitHub CLI for issue management

    Current workaround: Using gh issue create --web but this defeats the purpose of a CLI tool.

    Please prioritize this - it's a common need for developers who prefer CLI workflows! 🙏

  6. vipulgupta2048 commented on Mar 26, 2026

    @vipulgupta2048

    I built gitshot to solve exactly this - posted this image using gitshot 🎉 🎉
    GitShot is a zero-config, agent-ready CLI that uploads images to GitHub issues, PRs, and comments. Announcement.

  7. drogers0 commented on Mar 27, 2026

    @drogers0

    banner.png

    I built gh-image as a gh CLI extension to solve this. It replicates the browser's own upload flow, so images land at github.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.

    gh extension install drogers0/gh-image
    
    IMG=$(gh image banner.png --repo cli/cli)
    # => ![banner](https://github.com/user-attachments/assets/...
    
    gh issue comment 4465 --repo cli/cli --body "$IMG
    I built gh-image as a \`gh\` CLI extension to solve this...."

    ^ That's the command I used to post this.

    It automatically pulls your browser's session cookie, no tokens or OAuth setup required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions