2015-02-07 169 views
2

我正在尝试使用github API来创建特定组织下的存储库。我在看这site谈论如何创建特定组织下的存储库。如何通过github API在github中创建存储库?

Create a new repository in this organization. The authenticated user must be a member of the specified organization. 
POST /orgs/:org/repos 

现在我无法理解我需要使用哪个完整URL来创建特定组织下的存储库?我有我的用户名和密码,我可以通过https url在组织下创建存储库。

我的github例如URL是这样的 - https://github.host.com

而且我想我的仓库是这样得到创建后 -

https://github.host.com/Database/ClientService 

什么将是我的curl命令看起来像下创建存储库一个组织?

回答

5

你需要的所有信息here,在gihub帮助页面描述

https://developer.github.com/guides/getting-started/#create-a-repository

+0

感谢您的建议。这里的标志是什么?我将如何获得令牌?对不起,提出一个愚蠢的问题,第一次工作如此不确定。 – john 2015-02-07 18:44:26

+0

在这里阅读如何做到这一点: https://help.github.com/articles/creating-an-access-token-for-command-line-use – CodeWizard 2015-02-08 00:27:18

1

第1步:创建个人access token,并代替密码
第2步使用它:在命令行使用给定的API作为POST请求

https://api.github.com/orgs/<username or organisation_name>/repos?access_token=<generated token> 

在身体上,将其作为有效载荷传递:

{ 
    <br/>"name": "<Repo Name>",<br/> 
    "description": "<Some message>",<br/> 
    "homepage": "https://github.com",<br/> 
    "private": false,<br/> 
} 

您可以按照要求传递其他细节。
欲了解更多详情:click here