Creating Repositories in Organizations via API #24912
-
I’m trying to create repositories in an organization that I’m part of via the API. Everything up to this point has worked: getting repositories, org info, user info, etc. but I can’t get creation to work. I have the ability to do it myself and as far as I can tell, the personal access token I’ve generated has the permission scope to do it. I’m not sure where I should go from here; registering an OAuth app seems like overkill since I wanted to make a local script and the app requires a callback URI and the like. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
After 3 hours I realized that I honestly just was not including authentication in this one call. I’m the worst. |
Beta Was this translation helpful? Give feedback.
-
Hi @kuzi117, You’re certainly not the worst! I think everyone makes mistakes like that from time to time. I mean, who hasn’t debugged code for a couple of hours just to realize they missed a semicolon somewhere? That’s just as much of a mistake and it happens to the best of us. So don’t be so hard on yourself. :slight_smile: Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hey @that-pat, thanks for the kind words :slight_smile: I don’t know if you’re actually a GitHub employee or just a good community member, but it’s good to see you around. I do have another question now though, but I’m unsure where to ask it. It feels more like a bug report almost, but I guess I should just get right into it: part of this script is generating a repository in an organization, but the other part of inviting the correct members to participate in them. During testing I invited myself to test my code with the API (expecting 204 because I’m already a collaborator, since I’m the admin creating it). I got the 204, but when I went to go delete the repo because it had worked and I wanted to test something else I realised I couldn’t because that “invitation” had actually downgraded me to be just a regular collaborator without admin privileges! Does this sound like a bug or intended behavior? |
Beta Was this translation helpful? Give feedback.
-
@kuzi117 it’s hard to answer your question without knowing exactly how you formatted the API call. Is your code available somewhere public that we can take a look at it? Assuming that you are using the Add or update organization membership endpoint, it is entirely possible, depending on how you formatted your API call, for this to be the expected behavior. |
Beta Was this translation helpful? Give feedback.
After 3 hours I realized that I honestly just was not including authentication in this one call. I’m the worst.