본문으로 건너뛰기
Skillpedia
글쓰기48k · #6276

gh-attach

하는 일

이 도구는 GitHub에 이미지, PDF, 동영상 같은 파일을 올리고 내려받게 해 줍니다. 컴퓨터의 파일을 GitHub에서 볼 수 있는 링크로 만들거나, 기존 링크에서 파일을 내려받습니다.

사용하는 경우

  • ✓pull request(PR), 이슈, 또는 댓글에 이미지나 문서를 추가해야 할 때.
  • ✓프로젝트에 변경 전후를 비교하는 이미지를 넣고 싶을 때.
  • ✓GitHub 첨부 파일 링크를 받아 파일을 내려받아야 하는 경우.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/skills/gh-attach/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/skills/gh-attach/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 컴퓨터에 있는 이 이미지를 이슈 #123에 첨부해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 ‘gh-attach’라는 프로그램을 사용해 파일을 GitHub로 보내고 링크를 만듭니다. 이 링크는 PR, 이슈, 또는 댓글에 추가됩니다. 내려받을 때는 링크를 제공하면 도구가 파일을 컴퓨터에 저장합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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-attachments URL

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 ## Screenshots heading in the PR body with gh 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.zip to fetch a user-attachments file 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-attach can 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_session cookie 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.

…

자주 묻는 질문

파일이 GitHub에서 어떻게 보이나요?

GitHub는 파일 유형에 따라 링크를 이미지, 동영상, 또는 파일로 자동 표시합니다. 비공개 저장소의 파일은 그 저장소에 접근 권한이 있는 사람만 볼 수 있습니다.

컴퓨터에 GitHub를 설치해야 하나요?

예, 이 도구는 ‘gh’ 프로그램과 함께 작동하므로 gh가 설치되고 설정되어 있어야 합니다.

파일을 올리는 것은 안전한가요?

예, 공유하려는 파일만 올린다면 안전합니다. 비공개 저장소에 올린 파일은 비공개로 남습니다. 도구가 내부적으로 사용하는 ‘사용자 세션 쿠키’는 계정에 대한 전체 접근 권한을 주므로 절대 공유하지 마세요.

상세 정보

작성자의 원본 설명

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.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#6276
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬