gh-attach

Installation
SKILL.md

gh-attach

gh attach uploads a file to GitHub user-attachments 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 --pin v0.5.1

Supported images and videos on GitHub Cloud first use the active gh token, including legacy PATs, and need no browser session if the upload succeeds. Authentication or permission rejection falls back to matching browser cookies. Other file types, GHES, explicit browser/session options, and JSON fields id or originalName use the session-cookie flow directly. gh authentication selects the matching browser account. To choose a browser, add --browser <name> --profile <name>. For headless session-cookie use, set GH_ATTACH_SESSION_TOKEN to the bare user_session cookie value. Treat it as a full account credential; empty environment values are ignored.

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>)
Installs
2
First Seen
4 days ago