Note that there are some explanatory texts on larger screens.

plurals
  1. POgithub API - using curl PUT to add a repo to a team
    primarykey
    data
    text
    <p>I am trying to add a repo to a team on github, thus:</p> <pre><code>curl -i -u username:password -X PUT -d "" https://api.github.com/teams/:team/repos/:user/:repo </code></pre> <p>(specifics left out)</p> <p>Pretty much as indicated in the not so verbose documentation.<br> This gives a <code>500 Internal server error</code>. </p> <p>If I leave out the <code>-d""</code> it gives a <code>411 "Content-Length required"</code>,<br> if I specify (using <code>-H</code>) <code>"Content-Length: 0"</code>: again the <code>500</code> error...<br> Any clues?</p> <hr> <p>[edit] Answer: the API was giving spurious responses and the docs are not very good there:<br> "<code>:team</code>" 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.<br> Moreover, it does not seem that you can assign just <em>any</em> ol' repo under your account - it must be in the "organization" to which the team belongs.<br> Getting it there will apparently require some entertaining gymnastics... more if I figure it out. GitHub Usablity rating so far: (1-10) 2.</p> <hr> <p>[edit 2] The conclusion: the documents on github prescribe this:</p> <blockquote> <p>Add team repo</p> <p>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.</p> </blockquote> <pre><code>PUT /teams/:id/repos/:user/:repo </code></pre> <p>Does not work. What <em>does</em> work is this:</p> <pre><code>PUT /teams/:id/repos/:org/:repo </code></pre> <p>Replacing "<code>:user</code>" with "<code>:org</code>" (the name of the "organization" that the team belongs to.</p> <p>Case closed. Hopefully this helps somebody avoid a similarly entertaining afternoon.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload