Loading...
Loading...
Compare original and translation side by side
user-attachmentsgh-imagegh[name](url)gh-imageuser-attachmentsgh-imagegh[name](url)gh-imageghgh auth statusgh auth logingh-imagegh extension list | grep -q 'drogers0/gh-image' || gh extension install drogers0/gh-imagegh-imageghuser_session--token <value>GH_SESSION_TOKEN⚠️ Acookie grants full account access (it is not scoped like a PAT). Treat it like a password; in CI use a dedicated bot account.user_session
ghgh auth statusgh auth logingh-imagegh extension list | grep -q 'drogers0/gh-image' || gh extension install drogers0/gh-imagegh-imageghuser_session--token <value>GH_SESSION_TOKEN⚠️Cookie授予完整账户访问权限(不像PAT那样有范围限制)。请像对待密码一样妥善保管;在CI环境中请使用专用机器人账户。user_session
undefinedundefined
`gh image` prints the reference to **stdout** — an image embed for images, a bare
URL for videos (GitHub renders it as an inline player), and a download link for
other files, e.g.:
Capture that output — it is the embeddable reference. For multiple files it prints
one line per file.
`gh image` 将引用输出到**标准输出**——图片对应图片嵌入格式,视频对应纯链接(GitHub会渲染为内嵌播放器),其他文件对应下载链接,例如:
捕获该输出——这就是可嵌入的引用。如果上传多个文件,每个文件对应一行输出。gh-imageMD="$(gh image "/abs/path/shot.png" --repo owner/repo)"
BODY="$(gh pr view <pr> --repo owner/repo --json body -q .body)"
printf '%s\n\n## Screenshots\n\n%s\n' "$BODY" "$MD" \
| gh pr edit <pr> --repo owner/repo --body-file -MD="$(gh image "/abs/path/shot.png" --repo owner/repo)"
printf '## Screenshots\n\n%s\n' "$MD" | gh pr comment <pr> --repo owner/repo --body-file -gh issue edit <n> --body-file -gh issue comment <n> --body-file ---body-file ---bodygh-imageMD="$(gh image "/abs/path/shot.png" --repo owner/repo)"
BODY="$(gh pr view <pr> --repo owner/repo --json body -q .body)"
printf '%s\n\n## 截图\n\n%s\n' "$BODY" "$MD" \
| gh pr edit <pr> --repo owner/repo --body-file -MD="$(gh image "/abs/path/shot.png" --repo owner/repo)"
printf '## 截图\n\n%s\n' "$MD" | gh pr comment <pr> --repo owner/repo --body-file -gh issue edit <n> --body-file -gh issue comment <n> --body-file ---body-file ---bodygh pr view <pr> --repo owner/repo --json body -q .body # confirm the URL is presentuser-attachmentsgh pr view <pr> --repo owner/repo --json body -q .body # 确认链接已存在user-attachments<img width="800" alt="screenshot" src="https://github.com/user-attachments/assets/<uuid>" /><img width="800" alt="screenshot" src="https://github.com/user-attachments/assets/<uuid>" />| Symptom | Cause / fix |
|---|---|
| The org requires SSO and your session isn't authorized. Open the |
| The generic no-token case. Confirm you have write access; if the repo's org uses SSO, authorize at |
No | Log into GitHub in a supported browser, or set |
| Windows + Chrome 127+ can't read cookies | Known cookie-library limitation — use another browser or |
| CI / headless run | Set |
| Install the GitHub CLI ( |
| 症状 | 原因/解决方法 |
|---|---|
| 该组织要求SSO且你的会话未授权。在浏览器中打开消息中的 |
| 通用的无令牌情况。确认你拥有写入权限;如果仓库所属组织使用SSO,请访问 |
No | 在支持的浏览器中登录GitHub,或设置 |
| Windows + Chrome 127+无法读取Cookie | 已知的Cookie库限制——使用其他浏览器或设置 |
| CI / 无头环境运行 | 设置 |
| 安装GitHub CLI(例如 |