github API - 使用curl PUT为团队添加一个repo

ape*_*son 12 curl github put

我想在github上为团队添加一个repo,因此:

curl -i -u username:password  -X PUT  -d "" https://api.github.com/teams/:team/repos/:user/:repo
Run Code Online (Sandbox Code Playgroud)

(细节遗漏)

几乎不是那么详细的文档中指出的.
这给了一个500 Internal server error.

如果我遗漏-d""它给出一个411 "Content-Length required",
如果我指定(使用-H)"Content-Length: 0":再次500错误...
任何线索?


[编辑]答案:API提供了虚假的回复,文档在那里不是很好:
" :team"是系统分配的数字ID(不是你给它的名字...... arg!) - 它只能从API获得查询或在您访问团队时查看浏览器中的URL.多么优雅.
此外,您似乎不能在您的帐户下分配任何 ol'回购 - 它必须位于团队所属的"组织"中.
去那里显然需要一些有趣的体操...如果我弄清楚的话会更多.到目前为止GitHub Usablity评级:(1-10)2.


[编辑2]结论:github上的文件规定了这个:

添加团队回购

为了向团队添加回购,经过身份验证的用户必须是与该团队关联的组织的所有者.

PUT /teams/:id/repos/:user/:repo
Run Code Online (Sandbox Code Playgroud)

不行.是什么的工作是这样的:

PUT /teams/:id/repos/:org/:repo
Run Code Online (Sandbox Code Playgroud)

将" :user" 替换为" :org"(团队所属的"组织"的名称).

案件结案.希望这有助于有人避免同样有趣的下午.

小智 1

您还需要确保 :repo 是字段repo["name"],而不是repo["id"]字段。