Skip to content
Back to skills

Gh Attach

ASecurity

Attach local images or videos (screenshots, recordings) to GitHub issues, pull requests, and comments with `gh --attach`. Use before any `gh issue` or `gh pr` create, edit, or comment that carries a screenshot or recording.

  • 54,147 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 5, 2026
ai-agentsgobashgitapi

Works with

  • api

Security analysis

A100/100

Scanned December 5, 2026

npx -y skills add CherryHQ/cherry-studio --skill gh-attach --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Gh Attach?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Gh Attach
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/cherryhq-gh-attach/badge)](https://www.skillsdirectory.com/skills/cherryhq-gh-attach)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: gh-attach
description: Attach local images or videos (screenshots, recordings) to GitHub issues, pull requests, and comments with `gh --attach`. Use before any `gh issue` or `gh pr` create, edit, or comment that carries a screenshot or recording.
---

# Attaching Images and Videos to GitHub

`--attach <file>` (gh 2.99+) uploads each file and puts it into the body. It works on
`gh issue create|edit|comment` and `gh pr create|edit|comment`. `gh pr review` has no `--attach`,
so post a review's images in a `gh pr comment`. Each command's `--help` has the flag syntax.

## Check Every File First

**An upload cannot be taken back.** It is public as soon as it finishes, gh has no way to delete
it, and removing its reference from the body leaves the file at its public URL. Editing the issue,
pull request, or comment afterwards does not undo what a screenshot shows. Look at every image
yourself before uploading, and at frames extracted from each GIF or video with ffmpeg. Look for local
context: user names, home-directory paths, conversation or topic titles, browser tabs, other
windows, API keys, email addresses. Crop or recapture a file that shows any of it, or ask the user.

Wherever the user sees the body, in a preview before posting or in the report after it, list each
attachment's path with one line on what it shows.

## Place Files in the Body

Keep the files inside the repository, such as under `.context/verification/`, copying in any file from
elsewhere, and run gh from the repository root. Embed each image where it belongs in the body, and
pass the same file with `--attach`:

```markdown
![Settings page after saving an empty API key](.context/verification/<task>/settings-error.png)
```

```bash
gh issue create --title "<title>" --body-file "<body_file>" \
  --attach ".context/verification/<task>/settings-error.png"
```

Write the same relative path in both places. gh pairs a reference with its file by resolving both
against the directory gh runs in, not the body file's directory. A reference that does not pair
stays a broken local path, and its file is appended to the end of the body instead. A reference
whose upload fails is posted exactly as written, so the path itself must show nothing private, such
as a user name in a home directory.

A video plays only when its reference stands alone in a paragraph. Anywhere else, such as in a table
cell, gh turns it into a link.

## Read the Outcome

Whether a URL reached stdout decides the next step:

- **Non-zero exit, no URL, and one of these errors**: nothing was posted, so retrying is safe.
  `unknown flag: --attach` means gh is older than 2.99: ask the user to upgrade gh, or go on
  without attachments. `attaching files requires write access to the repository` means the account
  lacks `WRITE`, `MAINTAIN`, or `ADMIN` permission: go on without attachments. To go on without
  them, remove the image references from the body, post without `--attach`, and tell the user to
  drag the files into the issue, pull request, or comment on GitHub.
- **Non-zero exit, no URL, any other error**: the item may exist. `gh issue create`, for one,
  creates the issue before it sets the issue type, and prints the URL only after that. Look the
  item up by its title before posting again.
- **Non-zero exit, URL printed**: the issue, pull request, or comment exists, but uploads stopped
  at the first failure and the remaining references are still local paths. Repair what was posted
  instead of posting again, which would leave a duplicate. Pass every file again, since the body
  file still holds the local paths:

  ```bash
  gh issue edit "<url>" --body-file "<body_file>" --attach "<file_1>" --attach "<file_2>"
  gh pr edit "<url>" --body-file "<body_file>" --attach "<file_1>" --attach "<file_2>"
  # a comment: rewrite your last one
  gh pr comment "<number>" --edit-last --body-file "<body_file>" --attach "<file_1>"
  ```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.