Catalog
github/gh-attach

github

gh-attach

Uploads a local file (screenshot, image, PDF, zip, video) to GitHub user-attachments, downloads GitHub user-attachments, and embeds local files in a PR, issue, or comment. Use when asked to "attach a screenshot to the PR", "add an image to the issue", "embed before/after screenshots", "attach this file", or "download this GitHub attachment". Powered by `gh-attach`.

v1.0Latest
New~519Updated Aug 6, 2026

gh-attach

gh attach uploads a file to GitHub's internal user-attachments endpoint (no public API exists) and prints the URL, which GitHub auto-renders (image/video/file) wherever it's pasted. The URL inherits the repo's visibility, so private-repo uploads stay private.

Prerequisites

gh extension list | grep -q 'gh attach' || gh extension install sudosubin/gh-attach

Uploads use a GitHub browser session cookie, not the gh token. By default, gh must be authenticated so gh-attach can select the matching browser account. If the wrong account is selected, add --browser <name> --profile <name>. For headless use, set GH_ATTACH_SESSION_TOKEN to the bare user_session cookie value. Treat it as a full account credential.

Steps

1. Upload: Use an absolute quoted path. -R is optional inside a repository. For GHES, use -R host/owner/repo. The command prints the URL on one line. GitHub auto-renders it (image/video/file), so use it as-is:

URL=$(gh attach "$FILE" -R <owner>/<repo>)

2. Embed (always --body-file -, e.g. gh pr comment/edit, gh issue comment/edit):

printf '## Screenshots\n\n%s\n' "$URL" | gh pr comment <pr> -R <owner>/<repo> --body-file -

3. Download: Specify the destination explicitly. Private attachments use the active gh token, with browser cookies as an authorization fallback:

gh attach download "$URL" -O "$FILE"

Notes

  • Private repo: URL renders only for authorized viewers. An anonymous fetch is expected to return 404 or 403.
  • Sizing: embed <img width="800" src="$URL"> instead of the bare URL.
  • GitHub Cloud and GHES decide which file extensions and content types they accept.
Files1
1 files · 1.0 KB

Select a file to preview

Overall Score

77/100

Grade

B

Good

Safety

78

Quality

76

Clarity

82

Completeness

68

Summary

Instructs agents to use the `gh-attach` GitHub CLI extension to upload local files to GitHub user-attachments, generate shareable URLs, and embed them in pull requests, issues, and comments. The skill manages file uploads, browser authentication, and download workflows with clear scope limited to GitHub's attachment system.

Detected Capabilities

file read (local files for upload)shell execution (gh CLI commands)environment variable access (GH_ATTACH_SESSION_TOKEN)network request (GitHub attachment endpoint)file download

Trigger Keywords

Phrases that MCP clients use to match this skill to user intent.

attach screenshot to prembed image in issueupload github attachmentdownload attachment urladd before-after screenshotsattach file to comment

Risk Signals

WARNING

Environment variable for credential storage (GH_ATTACH_SESSION_TOKEN)

Prerequisites section
INFO

Reliance on browser session cookies for authentication

Prerequisites section
INFO

Private repo URL visibility inherits from repo permissions

Overview section

Use Cases

  • Upload and embed screenshots in pull request reviews
  • Attach images to GitHub issues for bug reporting
  • Download GitHub attachments from private repositories
  • Embed before/after screenshots in code review comments
  • Share video or PDF files via GitHub issue discussions
  • Attach build artifacts or logs to pull requests

Quality Notes

  • Clear prerequisites and authentication setup documented
  • Concrete shell command examples for each step (upload, embed, download)
  • Scope boundaries well-defined — operations limited to GitHub attachments only
  • Security model explicitly documented — private attachment visibility tied to repo permissions
  • GHES support documented with correct syntax
  • Missing edge cases: file size limits, unsupported file types, upload failure recovery
  • No error handling guidance for authentication failures or network issues
  • Download step security note is helpful but could elaborate on fallback authorization
  • Sizing optimization tip is useful but minor
Model: claude-haiku-4-5-20251001Analyzed: Aug 6, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Use github/gh-attach in your dev environment

Command Palette

Search for a command to run...