gh-attach

Uploads and downloads GitHub user-attachments and embeds them in issues and pull requests.

38.5k|4.9k|Updated Jun 11, 2025
One-click install
npx skills add https://github.com/github/awesome-copilot --skill gh-attach
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gh-attach
Source: https://github.com/github/awesome-copilot/tree/main/skills/gh-attach
Command: npx skills add https://github.com/github/awesome-copilot --skill gh-attach

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires gh-attach.

What problem does it solve?

GitHub provides no public API for uploading files to its user-attachments endpoint, making it hard to programmatically attach screenshots, videos, or files to issues and pull requests. This Skill wraps the gh-attach CLI extension to upload local files, retrieve shareable URLs, and embed them in PRs, issues, or comments.

Core Features & Use Cases

  • File Upload: Upload screenshots, images, PDFs, zips, and videos to GitHub user-attachments and get an auto-rendering URL that inherits the repository's visibility.
  • Embedding in Discussions: Insert uploaded attachment URLs into PR bodies, issue comments, or edits using gh pr comment/edit and gh issue comment/edit with --body-file -.
  • Attachment Download: Download GitHub user-attachments to a specified local path, using the gh token with browser cookies as an authorization fallback.
  • Use Case: After fixing a UI bug, upload before/after screenshots and embed them directly into the pull request so reviewers can see the visual change without leaving GitHub.

Quick Start

Attach the screenshot at ./screenshots/fix.png to pull request 42 in the current repository.

Frequently Asked Questions about gh-attach

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I attach a screenshot to a GitHub pull request from the command line?

Install the gh-attach extension, run gh attach with the file path to get an upload URL, then pipe that URL into gh pr comment with --body-file -. GitHub auto-renders image and video URLs inline.

Is there a GitHub API for uploading issue attachments?

No public API exists for GitHub user-attachments. The gh-attach extension uploads through GitHub's internal endpoint using a browser session cookie rather than the standard gh token.

Does gh-attach work with private repositories?

Yes, uploaded URLs inherit the repository's visibility, so private-repo attachments render only for authorized viewers. Anonymous requests to private attachment URLs return 404 or 403.

Can I use gh-attach in headless or CI environments?

Yes, set the GH_ATTACH_SESSION_TOKEN environment variable to the bare user_session cookie value for headless use. Treat this token as a full account credential since it grants session-level access.

Why does gh-attach select the wrong GitHub account?

Uploads rely on a browser session cookie, and gh-attach picks the account matching your gh authentication. If the wrong account is chosen, pass --browser and --profile flags to specify the correct one.