觉
AI觉醒星球
Awakening is here
Knowledge File / AI技能杠杆
2026-09-01 2 浏览 免费阅读

GitHub CLI:在 Issue、PR 和评论中支持媒体附件

GitHub CLI 新增 --attach 参数,可直接在命令行上传图片/视频到 issue、pull request 和评论,简化可视化沟通。

SOURCE / AI技能杠杆 MIN / 9 ACCESS / 免费阅读 POST / 2026-09-01 20:35:59

原贴

查看原文
作者:Allison 来源站点:github.blog 原贴时间:

原文

GitHub CLI now has a repeatable --attach flag that uploads a local image or video and references it inline in an issue, pull request, or comment body. This is now generally available to all users on GitHub across all plans. You just need to update gh to v2.99.0. Some things are easier to show than to describe (i.e., a UI bug, a rendered result, an error on screen). Previously, gh only wrote text, so adding an image or video to an issue or pull request meant stopping to open the browser, drag the file into the comment box, and copy the result back. Now, gh can attach images and videos directly from the command line. --attach puts the image in the same command that writes Markdown. File the bug, and the screenshot lands with it, so the issue shows the actual problem the first time. Open the pull request with a before and after, and the reviewer sees the change instead of pulling the branch to check. Your coding agents get this too, so they can show a result rather than describe it. Attach from commands that write Markdown text: --attach is repeatable and works on gh issue create , gh issue edit , gh issue comment , gh pr create , gh pr edit , and gh pr comment . Keep your Markdown as written: A local path already referenced in the body is rewritten in place, so ![alt](./login.png) keeps its alt text and becomes the uploaded asset. Anything attached but never referenced is appended at the end. Post images and video: PNG, JPEG, GIF, WebP, SVG, MP4, MOV, and WebM are all supported. Describe what you attach: Alt text follows the path after # , as in --attach './login.png#The login error state' . Omit it and gh falls back to the filename. Uploads authenticate with the common token types gh already uses, either the OAuth token from gh auth login or a classic personal access token. Write access to the repository you are attaching to is required for image uploading. --attach is generally available to all users on GitHub across all plans, with no preview period. Size limits match the web upload flow: 10 MB for images and GIFs, 10 MB for video on Free plans, and 100 MB for video on paid plans. GitHub Enterprise Server is not supported in this release. Update gh to v2.99.0, then run gh issue comment --attach ./screenshot.png . --attach works the same way on gh issue and gh pr create, edit, and comment. Run gh help for the full flag reference. Join the discussion on the GitHub Community and read the docs to learn more about attaching files from the command line.

中文翻译

GitHub CLI 现在有一个可重复的 --attach 标志,用于上传本地图片或视频,并在 issue、pull request 或评论正文中内联引用。现在,GitHub 所有计划的所有用户都可以普遍使用此功能。你只需将 gh 更新到 v2.99.0。有些事情用展示比用描述更容易(例如 UI 错误、渲染结果、屏幕上的错误)。以前,gh 只能写入文本,因此要在 issue 或 pull request 中添加图片或视频,需要停下来打开浏览器,将文件拖到评论框中,再将结果复制回来。现在,gh 可以直接从命令行附加图片和视频。--attach 将图片放在编写 Markdown 的同一命令中。提交错误,截图也随之提交,因此 issue 第一次就显示了实际问题。打开带有前后对比的 pull request,审查者看到的是变化,而不是拉取分支来检查。你的编码代理也能获得此功能,因此它们可以展示结果而不是描述结果。从编写 Markdown 文本的命令中附加:--attach 是可重复的,适用于 gh issue create、gh issue edit、gh issue comment、gh pr create、gh pr edit 和 gh pr comment。保持你的 Markdown 原文:正文中已引用的本地路径会被就地重写,因此 ![alt](./login.png) 会保留其 alt 文本并成为上传的资源。任何已附加但从未引用的内容都会追加在末尾。发布图片和视频:支持 PNG、JPEG、GIF、WebP、SVG、MP4、MOV 和 WebM。描述你要附加的内容:alt 文本位于路径之后的 # 后,如 --attach './login.png#The login error state'。省略时,gh 会回退到文件名。上传使用 gh 已有的常见令牌类型进行身份验证,可以是来自 gh auth login 的 OAuth 令牌,也可以是经典的个人访问令牌。进行图片上传需要对你附加到的仓库具有写入权限。--attach 对 GitHub 所有计划的所有用户普遍可用,没有预览期。大小限制与 Web 上传流程一致:图片和 GIF 为 10 MB,Free 计划视频为 10 MB,付费计划视频为 100 MB。此版本不支持 GitHub Enterprise Server。将 gh 更新到 v2.99.0,然后运行 gh issue comment --attach ./screenshot.png。--attach 在 gh issue 和 gh pr create、edit、comment 上的工作方式相同。运行 gh help 查看完整标志参考。加入 GitHub Community 的讨论并阅读文档,了解更多关于从命令行附加文件的信息。

核心信息

GitHub CLI 新增 --attach 参数,可直接在命令行上传图片/视频到 issue、pull request 和评论,简化可视化沟通。

  • GitHub CLI 新增 --attach 参数,可直接在命令行上传图片/视频到 issue、pull request 和评论,简化可视化沟通。
  • 原贴提到:GitHub CLI now has a repeatable --attach flag that uploads a local image
  • 来源:github.blog

详细解读

这是一个重要的开发者工具更新,GitHub CLI 将媒体附件能力直接嵌入命令行,标志着纯文本工作流向富媒体协作的深刻转变。过去,开发者描述 UI bug、分享渲染结果或展示屏幕错误,往往需要打断心流,切换到浏览器,拖拽文件,再复制回命令行。现在,--attach 允许同一个命令完成“创建内容+附加媒体”,极大降低了可视化沟通的成本。

这个信号对三类人尤其有价值:第一,频繁在 issue/PR 中协作的开发者,他们现在可以更准确地传达问题,减少往返沟通;第二,依赖 GitHub CLI 进行自动化的 DevOps 工程师,可将截图上传集成到 CI/CD 或测试流程中,让失败报告自带现场证据;第三,使用 AI 编码代理(如 Copilot)的用户,代理现在也能“展示”结果而非仅“描述”,使 AI 协作更可验证,这将推动人机协作的新范式。

要立刻行动,只需升级 gh 到 v2.99.0,然后在常用命令后添加 --attach './path.png'。更高效的做法是,将截图绑定到自定义命令或 shell 别名中,比如把冒烟测试失败直接发送到 issue 并附带截图。但你也要注意限制:该功能不支持 GitHub Enterprise Server,且图片上传需要仓库写权限;免费计划视频仅 10 MB,付费计划也不过 100 MB,大文件仍需走 web 上传。因此,它更适合快速辅助证据,而非大规模媒体归档。

信息差价值

这条内容的真正价值,不只是“有人发布了一个新功能”,而是它揭示了 github.blog 背后的产品方向、工作流变化或竞争信号。对 OPC 来说,这种信息可以转化成持续追踪的栏目选题。

如果把《GitHub CLI:在 Issue、PR 和评论中支持媒体附件》放到你的内容系统里,它最大的价值在于帮助读者更快看懂“为什么值得关注”,而不是只看到一条碎片化动态。

参考来源

AI SUMMARY

这篇文章回答了什么

GitHub CLI:在 Issue、PR 和评论中支持媒体附件主要讲什么?

GitHub CLI 新增 --attach 参数,可直接在命令行上传图片/视频到 issue、pull request 和评论,简化可视化沟通。

这篇文章最值得关注的要点是什么?

GitHub CLI 新增 --attach 参数,可直接在命令行上传图片/视频到 issue、pull request 和评论,简化可视化沟通。;原贴提到:GitHub CLI now has a repeatable --attach flag that uploads a local image;来源:github.blog

这篇文章和哪些AI专题相关?

它适合放在Agent工作流、AI超级个体、AI工具专题里阅读。 关联原因:这篇内容命中「Agent、工作流」等主题信号。;这篇内容命中「效率、技能」等主题信号。;这篇内容来自该专题长期覆盖的栏目。

阅读这篇文章建议先理解哪些关键词?

建议先理解AI工具、工具、自动化、模型、Cursor这些关键词,再结合正文判断工具、机会或风险是否值得进入自己的工作流。

上一篇 Runway 的 Solaris:实时生成软件界面的 AI 系统 下一篇 基于 MiniMax H3 Max 的 24 小时 AI 直播网站上线了