gh-attach
Was er macht
Dieses Tool lädt Dateien (wie Bilder, PDFs oder Videos) zu GitHub hoch und lädt sie auch wieder herunter. Aus einer lokalen Datei wird ein teilbarer Link, der direkt auf GitHub angezeigt werden kann. Oder es lädt eine Datei von einem bestehenden Link herunter.
Wann du ihn nutzt
- ✓Wenn du ein Bild oder Dokument zu einem Pull Request (PR), einem Issue oder einem Kommentar auf GitHub hinzufügen willst.
- ✓Um Vorher-Nachher-Vergleiche als Bilder in einem Projekt einzubinden.
- ✓Wenn du einen Link zu einem GitHub-Anhang bekommst und die Datei herunterladen willst.
Link zum Skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/skills/gh-attach/SKILL.mdKopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.
So nutzt du ihn
Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.
Fertige Nachricht zum Einfügen
Für Claude Code, Codex oder Cursor: Führe den Befehl in deinem Projektordner aus, dann wird der Skill installiert.
Lade die SKILL.md herunter und lege sie in den Skills-Ordner deines Agenten.
Beispielanfrage an deine KI
“Hänge dieses Bild von meinem Computer an Issue #123 an.”
5 neue Skills pro Woche. 1 Minute Lesezeit.
So funktioniert es
Das Tool nutzt ein Programm namens 'gh-attach', um deine Datei zu GitHub zu schicken und daraus einen Link zu erstellen. Dieser Link wird dann in deinen Pull Request, dein Issue oder deinen Kommentar eingefügt. Zum Herunterladen gibst du den Link an, und das Tool speichert die Datei auf deinem Computer.
Technischer Inhalt (originale SKILL.md)
Originaltext des Autors, auf Englisch, direkt von GitHub.
Upload and download GitHub user-attachments (gh-attach)
GitHub has no public API for user-attachments. The web UI uses an internal
endpoint that mints github.com/user-attachments URLs whose visibility follows the
repository they belong to. gh-attach
(MIT, sudosubin) replicates that drag-and-drop flow as a gh CLI extension, so an
agent can upload a local file from the terminal, get a URL back, and later download
an attachment URL to a file.
Overview
This skill drives gh-attach to turn a local file (screenshot, image, PDF, zip,
log, or video) into a hosted GitHub user-attachments URL, then embeds that URL
into a pull request, issue, or comment. It also downloads an existing attachment
URL back to a local file. GitHub auto-renders the URL as an image, video, or file
wherever it is pasted, and the URL inherits the repository's visibility, so a
private-repo upload stays private. It works against GitHub Cloud and GitHub
Enterprise Server.
When to Use This Skill
Use this skill when asked to:
- "Attach a screenshot to the PR" or "add an image to the PR description"
- "Attach this file (PDF, zip, log, video) to the issue or comment"
- "Embed before/after screenshots" in a PR, issue, or README
- "Download this GitHub attachment" from a
user-attachmentsURL
How It Works
Step 1: Verify prerequisites
gh auth status # gh installed and authenticated
gh extension install sudosubin/gh-attach --pin v0.4.2 --force
gh extension list | grep -F 'sudosubin/gh-attach' # require the reviewed v0.4.2 release
Uploads use a GitHub user_session browser cookie, not the gh token (that
endpoint rejects tokens). By default gh must be authenticated so gh-attach can
select the matching browser account (Chromium family, Firefox family, or Safari).
If the wrong account is selected, add --browser <name> --profile <name>. Obtain
explicit approval before allowing the pinned extension to access that interactive
browser profile. Headless and CI uploads are intentionally unsupported: never export,
store, or pass a raw user_session cookie to the extension.
Step 2: Upload
# Use an absolute quoted path; -R is optional inside a repo working dir.
URL=$(gh attach "/abs/path/screenshot.png" -R <owner>/<repo>)
gh attach prints the URL on one line to stdout. For GitHub Enterprise Server,
use -R host/owner/repo. Capture the output; it is the embeddable reference.
Step 3: Embed into the PR / issue / comment
printf '## Screenshots\n\n%s\n' "$URL" \
| gh pr comment <pr> -R <owner>/<repo> --body-file -
Use gh pr edit, gh issue comment, or gh issue edit with --body-file - for
other targets. Always pass --body-file - (not inline --body) so multi-line
bodies and special characters cannot break shell quoting. GitHub auto-renders the
URL, so paste it as-is.
Step 4: Download
# Specify the destination explicitly.
gh attach download "$URL" -O "/abs/path/out.png"
Downloads of private attachments use the active gh token, with browser cookies as
an authorization fallback.
Examples
- Attach a screenshot to PR #42: upload the file, then append the URL under a
## Screenshotsheading in the PR body withgh pr edit ... --body-file -. - Embed before/after screenshots in a README: upload both files, paste the two URLs into the README at the relevant section.
- Download an attachment for review: run
gh attach download "$URL" -O out.zipto fetch auser-attachmentsfile locally.
Best Practices
- Resolve globs to absolute paths first, and quote paths that contain spaces or Unicode.
- For display sizing, embed an HTML tag instead of the bare URL:
<img width="800" src="$URL">. - Keep uploads interactive. Do not place a GitHub browser session in CI, an environment variable, a secret store consumed by this extension, or an agent log.
gh-attachcan upload multiple files concurrently and emit Markdown or JSON output with jq-style filtering when you need to script around the result.
Limitations
- Interactive session cookie required. A
user_sessioncookie grants full account access and is not scoped like a PAT. The supported path is the reviewed, pinned extension reading an explicitly approved local browser profile; CI and headless cookie injection are out of scope.
…
Häufige Fragen
Wie wird die Datei auf GitHub sichtbar?
GitHub zeigt den Link automatisch als Bild, Video oder Datei an, je nach Dateityp. Liegt die Datei in einem privaten Repository, funktioniert der Link nur für Personen mit Zugriff auf dieses Repository.
Muss ich GitHub auf meinem Computer installiert haben?
Ja. Du brauchst das Programm 'gh', das installiert und eingerichtet sein muss, weil das Tool damit zusammenarbeitet.
Ist das Hochladen von Dateien sicher?
Ja, solange du nur Dateien hochlädst, die du auch teilen möchtest. Dateien in privaten Repositories bleiben privat. Wichtig: Gib niemals das 'User-Session-Cookie' weiter, das das Tool intern verwendet. Es gewährt vollen Zugriff auf dein Konto.
Details
Originalbeschreibung des Autors
Upload and download GitHub user-attachments (screenshots, PDFs, zips, videos) from the terminal; use when asked to attach or embed a file in a PR, issue, or comment, or download an attachment URL.
Beliebtheit
- GitHub-Sterne
- 48k
- Platz im Ranking
- #6276
- Lizenz
- MIT
- Aktualisiert
- 15.10.2026
Kommentare
- …
Weitere Skills aus diesem Repository
00-andruia-consultant
48kHilft deinem Agenten, KI-Projekte zu starten oder zu verbessern. Er analysiert Code, schlägt Tools vor und erstellt Aktionspläne auf Spanisch.
007
48kLässt deinen Agenten Sicherheitsaudits und Bedrohungsmodellierung durchführen. Nützlich, um Projekte vor Angriffen und Schwachstellen zu schützen.
10-andruia-skill-smith
48kHilft deinem Agenten, KI-Tools zu erstellen oder zu verbessern. Er legt fest, wie Tools funktionieren, schreibt die Dokumentation und prüft die Struktur.
20-andruia-niche-intelligence
48kLässt deinen Agenten eine Branchenzusammenfassung erstellen. Nützlich, um Kontext, Regeln, Nutzungsmuster und Risiken anhand verlässlicher Quellen zu verstehen.
Ähnliche Skills
obsidian-vault-maintainer
394kHilft deinem Agenten, einen Obsidian-tauglichen Gedächtnis-Vault ordentlich zu halten, mit funktionierenden Wiki-Links, einheitlichen Eigenschaften und sicheren generierten Abschnitten.
wiki-maintainer
394kHilft deinem Agenten, ein OpenClaw-Gedächtnis-Wiki mit wiederholbaren Seiten, sicheren verwalteten Blöcken und Prüfungen auf Widersprüche oder Lücken zu pflegen.
obsidian
394kLässt deinen Agenten Obsidian-Notizen, Aufgaben, Links und Eigenschaften mit der offiziellen Obsidian-Kommandozeile lesen, durchsuchen, erstellen und bearbeiten.