gh-attach
Ce qu’il fait
Cet outil vous permet d'envoyer et de télécharger des fichiers (images, PDF ou vidéos) sur GitHub. Il transforme un fichier local en lien partageable, visible directement sur GitHub, ou télécharge un fichier à partir d'un lien existant.
Quand l’utiliser
- ✓Quand vous voulez ajouter une image ou un document à une pull request (PR), à une issue ou à un commentaire sur GitHub.
- ✓Pour intégrer des images montrant une comparaison avant-après dans un projet.
- ✓Quand vous recevez un lien vers une pièce jointe GitHub et que vous devez télécharger le fichier.
Lien du skill
https://github.com/sickn33/agentic-awesome-skills/blob/main/skills/gh-attach/SKILL.mdCopiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.
Comment l’utiliser
Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.
Message prêt à coller
Pour Claude Code, Codex ou Cursor : lancez-la dans le dossier du projet et le skill est installé.
Téléchargez le SKILL.md et placez-le dans le dossier de skills de votre agent.
Exemple de demande à votre IA
“Attache cette image de mon ordinateur à l'issue #123.”
5 nouveaux skills par semaine. 1 minute de lecture.
Comment ça marche
L'outil utilise un programme appelé « gh-attach » pour envoyer votre fichier sur GitHub, ce qui crée un lien. Ce lien est ensuite ajouté à votre pull request, à votre issue ou à votre commentaire. Pour télécharger un fichier, vous fournissez le lien et l'outil l'enregistre sur votre ordinateur.
Contenu technique (SKILL.md original)
Texte original de l’auteur, en anglais, directement depuis 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.
…
Questions fréquentes
Comment le fichier devient-il visible sur GitHub ?
GitHub affiche automatiquement le lien sous forme d'image, de vidéo ou de fichier, selon le type de contenu. Si le fichier se trouve dans un dépôt privé, le lien ne fonctionne que pour les personnes ayant accès à ce dépôt.
Dois-je avoir GitHub installé sur mon ordinateur ?
Oui, vous devez avoir installé et configuré le programme « gh » pour utiliser cet outil, car il fonctionne avec lui.
Est-il sûr d'envoyer des fichiers ?
Oui, tant que vous envoyez des fichiers que vous souhaitez partager. Les fichiers envoyés dans un dépôt privé restent privés. Il est essentiel de ne jamais partager le cookie de session utilisateur utilisé en interne par l'outil, car il donne un accès complet à votre compte.
Détails
Description originale de l’auteur
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.
Popularité
- Étoiles GitHub
- 48k
- Position au classement
- #6276
- Licence
- MIT
- Mis à jour
- 15/10/2026
Commentaires
- …
Autres skills de ce dépôt
00-andruia-consultant
48kAide votre agent à lancer ou améliorer des projets d'IA. Il analyse le code, suggère des outils et crée des plans d'action en espagnol.
007
48kPermet à votre agent de réaliser des audits de sécurité et des modélisations de menaces. Utile pour protéger les projets contre les attaques et les vulnérabilités.
10-andruia-skill-smith
48kAide votre agent à créer ou améliorer des outils d'IA. Il définit leur fonctionnement, rédige la documentation et valide la structure.
20-andruia-niche-intelligence
48kPermet à votre agent de rédiger une synthèse sur un secteur d'activité précis. Utile pour comprendre le contexte, les règles, les usages et les risques, à partir de sources fiables.
Skills similaires
obsidian-vault-maintainer
394kAide votre agent à entretenir un coffre de mémoire compatible Obsidian, avec des liens wiki fonctionnels, des propriétés cohérentes et des sections générées sûres.
wiki-maintainer
394kAide votre agent à entretenir un wiki de mémoire OpenClaw avec des pages reproductibles, des blocs gérés sûrs et des contrôles des contradictions ou lacunes.
obsidian
394kPermet à votre agent de lire, rechercher, créer et modifier des notes, tâches, liens et propriétés Obsidian grâce à la ligne de commande officielle d'Obsidian.