简体   繁体   English

无法在私人仓库中使用个人访问令牌列出仓库 webhook

[英]Cannot list repository webhooks using personal access token in private repo

I'm working on two repos, one is private and one is public.我正在处理两个回购协议,一个是私人的,一个是公共的。 In the public repo, I can create a personal access token with repo/webhooks admin permissions and I can run the following command:在公共 repo 中,我可以创建一个具有 repo/webhooks 管理员权限的个人访问令牌,我可以运行以下命令:

curl -si https://api.github.com/repos/{user}/{repo}/hooks -H "Authorization: token {token}"

and I get back [] , an empty list because there's no webhooks.然后我返回[] ,这是一个空列表,因为没有 webhook。

In the private repo, if I create a personal access token, even with all permissions, I always get:在私人仓库中,如果我创建个人访问令牌,即使拥有所有权限,我总是会得到:

{
  "message": "Not Found",
  "documentation_url": "https://docs.github.com/rest/webhooks/repos#list-repository-webhooks"
}

What's going on here?这里发生了什么? Is it possible that programmatic access to webhooks is somehow disabled by the repo owner or something?回购所有者或其他人是否有可能以某种方式禁用对 webhooks 的编程访问?

I can see other resources of the private repo with the token though, like /repos/{user}/{repo}/branches .不过,我可以看到带有令牌的私人回购的其他资源,比如/repos/{user}/{repo}/branches It is specifically /hooks that does not work.特别是/hooks不起作用。

Found the problem.发现了问题。 In order to access webhooks via the github API the token needs to be bound to an account with a role that has the Manage Webhooks permissions.为了通过 github API 访问 webhooks,令牌需要绑定到具有Manage Webhooks权限的角色的帐户。

On my personal repo, I had the admin role which has that permission by default, on the private repo I had the write role which does not.在我的个人回购协议中,我拥有默认具有该权限的admin角色,在私人回购协议中我拥有write角色,但没有。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 GitHub 个人访问令牌私人回购 scope - GitHub Personal Access Token Private repo scope Github 用于访问私有存储库的个人访问令牌:/repos/:user/:repo/contents - Github personal access token for accessing private repository's: /repos/:user/:repo/contents 无法使用个人访问令牌访问私人 Git 回购 - Can't Access Private Git Repo With Personal Access Token 使用个人访问令牌将 Gradle 上的脚本应用于私有(企业)github 存储库 - Apply Script on Gradle to private (enterprise) github repo using personal access token 在将个人访问令牌添加到 .npmrc 后,在私有仓库上获得 404 - Getting a 404 on a private repo after adding a personal access token to .npmrc 从 github 私人仓库安装 package 没有个人访问令牌 - Install package from github private repo without personal access token 使用个人访问令牌 Netbeans 克隆私有 Github 回购 - Clone a Private Github Repo with a Personal Access Token Netbeans Git clone总是要求个人访问令牌(私人仓库) - Git clone always asks for Personal Access Token (private repo) 如何使用个人访问令牌在 github 操作工作流 (B) 中从不同的存储库 (B) 提交和推送到私有存储库 (A) - How to commit and push to a private repo(A), from a different repo(B), in github actions workflow (B) , using personal access token 无法使用个人访问令牌 ubuntu/zorin 推送到远程仓库 - cannot push to remote repo with personal access token ubuntu/zorin
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM