You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用curl从GitHub私有仓库下载发布资产失败问题排查

问题:curl无法从GitHub私有仓库下载发布资产,返回“Not Found”

我尝试使用curl从GitHub私有仓库下载发布资产,执行命令如下:

curl -H "Accept: application/vnd.github+json"  -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: Bearer XXXXXXXX" -LJO https://github.com/Org/repo/releases/download/0.4.2/repo-linux-amd64

但始终获取到内容为“Not Found”的文件。不过在已认证的浏览器窗口打开该链接却能正常下载文件。

我已完成以下排查步骤:

  • 用下方命令测试token有效性,结果正常:
    curl -H "Authorization: token XXXXXXXX" https://api.github.com/user
    
  • gh命令可正常执行(token已导出到GITHUB_TOKEN环境变量),说明token具备正确权限:
    gh release download 0.4.2 --pattern repo-linux-amd64 -R Org/repo
    
  • 尝试将Authorization头中的Bearer替换为token,结果仍然返回“Not Found”:
    curl -H "Accept: application/vnd.github+json"  -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: token XXXXXXXX" -LJO https://github.com/Org/repo/releases/download/0.4.2/repo-linux-amd64
    

请问我遗漏了什么?


内容的提问来源于stack exchange,提问作者pkaramol

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.31 18:50:43