How to create Organization name through Github API instead of creating manually?

前端 未结 4 1406
深忆病人
深忆病人 2020-12-20 02:22

I am trying to use github api to create organization and repositories instead of creating them manually. I was looking at this site which talks about how to create repositor

4条回答
  •  盖世英雄少女心
    2020-12-20 02:47

    GitHub doesn't privide a public api for that.

    But say if you want to automate the organization creation process, you can inspect the network activity (press F12 in your browser and navigate to the network tab) on this page

    https://github.com/account/organizations/new

    to find out the private api for checking name availability and creating an organization, then export the request as curl command, put it in a shell script and parameterize the organization name.

    I won't go into details or post my script here because the script is fairly to trivial to write and it will leak my browser cookie and session information

    btw if you are using GitHub Enterprise then it's documented here

    https://developer.github.com/enterprise/2.16/v3/enterprise-admin/orgs/ https://github.com/aws-quickstart/quickstart-github-enterprise/blob/master/scripts/adminuser_org_repo.sh

    Update:

    WARNING!!! Be careful not to create too many organizations. I currently have created over 500+ organizations with my personal account. Now each time I visit a page on github with my account logged in, it will either take seconds to load or doesn't load at all, showing the unicorn page like https://github.com/503.html. If I log out of my account, the page loads quickly again. I've pretty much given up using the github web ui.

提交回复
热议问题