New to Claude Skills? Learn how to install them →

github on GitHub

GitHub Attach

OfficialFree

Easily manage file attachments in GitHub.

by github37.7k stars on github/awesome-copilot
4 views
Updated Aug 10, 2026
Get this skill

Free · Opens the source repo

What GitHub Attach does

GitHub Attach is a command-line tool designed to streamline the process of managing file attachments within GitHub repositories. It allows users to upload local files, such as images, PDFs, and videos, directly to GitHub's user-attachments endpoint. Once uploaded, the tool provides a URL that can be used to embed the file in pull requests, issues, or comments, making it easier to share relevant files with collaborators. The tool is particularly useful for developers and designers who frequently need to attach screenshots or other files to their GitHub discussions.

The functionality of GitHub Attach is straightforward. Users can upload files by specifying the absolute path to the file and, optionally, the repository. After the upload, the tool prints a URL that GitHub automatically renders, allowing for seamless integration into comments or PR descriptions. This feature is especially beneficial for teams that rely on visual documentation, as it ensures that all team members can easily access the files without navigating away from the GitHub interface.

Additionally, GitHub Attach supports downloading files from the user-attachments endpoint, which is essential for retrieving previously uploaded files. The tool respects the visibility settings of the repository, ensuring that private files remain secure and accessible only to authorized users. This makes it a reliable choice for teams working on sensitive projects where confidentiality is paramount.

Overall, GitHub Attach is an invaluable tool for anyone who regularly interacts with GitHub and needs to manage file attachments efficiently. Its integration with GitHub's existing framework allows for a smooth user experience, making it a practical addition to any developer's toolkit.

When to use it

Use GitHub Attach when you need to upload files to GitHub and embed them in issues or pull requests.

When not to use it

This tool is not suitable for users who do not use GitHub or require public file uploads, as it relies on GitHub's internal user-attachments endpoint.

What you can build with it

Attaching Screenshots to PRs

Use GitHub Attach to quickly upload and embed screenshots in your pull request comments, enhancing communication with visual context.

Embedding Images in Issues

Easily attach images to GitHub issues to provide clearer descriptions or examples, making it easier for collaborators to understand the problem.

Downloading Previous Attachments

Retrieve previously uploaded files from GitHub user-attachments for reference or reuse in your current projects.

How to install GitHub Attach

View source

1. Install with the skills CLI

npx skills add github/awesome-copilot/gh-attach --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by github

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.

Frequently asked questions about GitHub Attach

Similar skills