I am trying to add a repo to a team on github, thus:
curl -i -u username:password -X PUT -d "" https://api.github.com/teams/:team/repos/:user/:repo
(specifics left out)
Pretty much as indicated in the not so verbose documentation.
This gives a 500 Internal server error
.
If I leave out the -d""
it gives a 411 "Content-Length required"
,
if I specify (using -H
) "Content-Length: 0"
: again the 500
error...
Any clues?
[edit] Answer: the API was giving spurious responses and the docs are not very good there:
":team
" is a numerical id assigned by the system (not the name you gave it .. arg!) - it is available only from an API query or from looking at the url in the browser when you visit the team. How elegant.
Moreover, it does not seem that you can assign just any ol' repo under your account - it must be in the "organization" to which the team belongs.
Getting it there will apparently require some entertaining gymnastics... more if I figure it out. GitHub Usablity rating so far: (1-10) 2.
[edit 2] The conclusion: the documents on github prescribe this:
Add team repo
In order to add a repo to a team, the authenticated user must be an owner of the org that the team is associated with.
PUT /teams/:id/repos/:user/:repo
Does not work. What does work is this:
PUT /teams/:id/repos/:org/:repo
Replacing ":user
" with ":org
" (the name of the "organization" that the team belongs to.
Case closed. Hopefully this helps somebody avoid a similarly entertaining afternoon.
You also need to make sure that the :repo is the repo["name"]
field, NOT the repo["id"]
field.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With