How to create GitHub repository under an organization from the command-line?
To create a repository under an organisation you should send the request to the POST /orgs/:org/repos
endpoint rather than /user/repos
. Your user shouldn't need any extra permissions or scopes over what is required to create a user repository, but the user must be a member of :org
:
Create
Create a new repository for the authenticated user. (Currently not enabled for Integrations)
POST /user/repos
Create a new repository in this organization. The authenticated user must be a member of the specified organization.
POST /orgs/:org/repos
(From https://developer.github.com/v3/repos/#create)
With the new github cli, it is as simple as:
gh repo create ORGNAME/REPONAME