Eya*_*ber 4 git bash github-api git-bash
当使用github cli api通过 git-bash 终端读取拉取请求数据时,出现“gh: Not Found (HTTP 404)”错误。当我通过 PowerShell 终端或 wsl 运行完全相同的脚本时,效果很好。知道为什么会发生这种情况吗?
虽然REST API 中的 gh 代码示例确实有一个额外的/前缀,但实际的gh api 手册页没有:
例子:
# list releases in the current repository
$ gh api repos/{owner}/{repo}/releases
# post an issue comment
$ gh api repos/{owner}/{repo}/issues/123/comments -f body='Hi from CLI'
Run Code Online (Sandbox Code Playgroud)
端点参数中的占位符值“
{owner}”、“{repo}”和“{branch}”将替换为当前目录的存储库或GH_REPO环境变量中指定的存储库中的值。请注意,在某些 shell 中(例如 PowerShell),您可能需要将任何包含“
{...}”的值括在引号中,以防止 shell 对花括号应用特殊含义。