Create GitHub organization repository from command line

It’s my understanding that to create a personal repository on the command line, using the GitHub v3 API, one can do this (replacing USERNAME and REPONAME appropriately):

curl -u 'USERNAME' -d '{"name":"REPONAME"}'

The user then enters their username and password, and GitHub will create a new empty repository at “”.

My question is, how do I create an organization-owned repository via command line? I tried replacing USERNAME with the organization’s name, and it prompted me for the ‘host password’. I own the organization so I entered my password but I got “Bad credentials”. Does this method not work for organization-owned repositories? Or am I doing something wrong? Thanks in advance.

  • Authenticate with and push with LibGit2Sharp to GitHub repository
  • How to retrieve the list of all github repositories of a person?
  • Check the existance of a GitHub repo?
  • How to add submodule into gh-pages branch & build static pages correctly?
  • Creating a fork with the GitHub V3 API (REST)
  • How to get a list of pull requests between 2 commits
  • Is there a way to get the latest tag of a given repo using github API v3
  • GitHub OAuth2 Token: How to restrict access to read a single private repo
  • 3 Solutions collect form web for “Create GitHub organization repository from 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 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


    Just for completeness: Example for Git Api v3:

    curl -u USERNAME -d '{"name":"NAME_OF_REPO", "description":"SOME_DESCRIPTION", "private": true, "has_issues": true, "has_projects": true, "has_wiki":false }'

    EDIT: My bad, I misread your question. I thought it was about creating an organization. I will still leave this here, though, for reference. @kfb’s answer looks like it is what you are looking for.

    From the looks of it, I don’t believe this is possible. Github’s API does not have an endpoint for creating an organization.

    You can take a look at the documentation for it here. It shows all of the operations you can do in relation to organizations (including getting an organization, listing organizations, and editing an organization), but does not have creating one.

    It also does not look like you can create a new user, either. It is most likely that they don’t support this so that people don’t create too many users/organizations.

    Git Baby is a git and github fan, let's start git clone.