存储库处于组织状态时,Github Api列表提交状态 [英] Github Api list commit status when repository is under organisation

查看:50
本文介绍了存储库处于组织状态时,Github Api列表提交状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用github rest api列出存储库的提交状态.

I am trying to list status of commits for a repository using github rest api.

存储库处于组织之下,并且是私有的.
repos_url https://api.github.com/orgs/mydummyorg/repos

The repository is under organisation and is private.
The repos_url of which is https://api.github.com/orgs/mydummyorg/repos

具有访问权限的用户可以查看给定引用的提交状态:

Users with pull access can view commit statuses for a given ref:

    GET /repos/:owner/:repo/commits/:ref/statuses

根据上面的api,是GET网址

As per the api above is the GET url

所以我的最终URL是repos_ulr + :owner/:repo/commits/:ref/statuses

So my final url will be repos_ulr + :owner/:repo/commits/:ref/statuses

如果我按如下所示进行卷曲,则表明未找到404

If I do the curl as below then it is giving 404 not found

curl -u "username" https://api.github.com/orgs/mydummyorg/repos/:owner:repos/commits/:ref/statuses

位置:

  • :owner =用户名(我在git中的登录ID)
  • :repos ='mydummyorg
  • 下的存储库名称
  • :ref =提交的阴影
  • :owner = username (my login id in git)
  • :repos = repository name under 'mydummyorg
  • :ref = sha of the commit`

我不知道我在做什么错.我的网址正确吗?
我为:owner:repos:ref传递的值正确吗?

I don't know what am I doing wrong. Is my url proper?
And the value that I am passing for :owner , :repos, :ref correct?

推荐答案

我所能看到的是:

  • 在卷曲中,您提到的是:owner:repos而不是:owner/:repos(可能是您的问题是错字,或者您忘记了'/')
  • GET /repos/:owner/:repo/commits/:ref/statuses表示应为

  • in your curl, you mention :owner:repos instead of :owner/:repos (maybe a typo in your question, or you forgot a '/')
  • GET /repos/:owner/:repo/commits/:ref/statuses means the "List Statuses for a specific Ref" API should be

https://api.github.com/ + /repos/:owner/:repo/commits/:ref/statuses

(不是/repos/:owner/:repo/commits/:ref/statuses前面的orgs/mydummyorg/)

最后,您需要在该私人仓库上注册为所有者或合作者,或者即使您通过完整的凭据(用户名+密码),答案也始终是404.
确保您未激活
2FA ,否则您的用户名+密码将无效(您需要使用

Finally, you need to be registered as the owner or collaborator on that private repo, or even if you do pass your complete credentials (username + password), the answer will always be 404.
Make sure you didn't activate 2FA, or your username+password wouldn't work (you would need to use a PAT -- Personal Access Token -- instead)

OP Bhavik Shah 详细信息

我能够解决此问题.
我通过的所有者详细信息有误.应该是存储库所在的组织名称.

I was able to resolve the issue.
The owner detail that I was passing was wrong. It should be organisation name under which the repository is present.

这篇关于存储库处于组织状态时,Github Api列表提交状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆