POST /orgs/{org}/repos

Creates a new repository in the specified organization. The authenticated user must be a member of the organization.

OAuth app tokens and personal access tokens (classic) need the public_repo or repo scope to create a public repository, and repo scope to create a private repository.

Servers

Path parameters

Name Type Required Description
org String Yes

The organization name. The name is not case sensitive.

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/json"

Request body fields

Name Type Required Description
description String No

A short description of the repository.

team_id Integer No

The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization.

license_template String No

Choose an open source license template that best suits your needs, and then use the license keyword as the license_template string. For example, "mit" or "mpl-2.0".

merge_commit_message String No

The default value for a merge commit message.

  • PR_TITLE - default to the pull request's title.
  • PR_BODY - default to the pull request's body.
  • BLANK - default to a blank commit message.

Possible values:

  • "BLANK"
  • "PR_BODY"
  • "PR_TITLE"
has_wiki Boolean No

Either true to enable the wiki for this repository or false to disable it.

Default value: true

merge_commit_title String No

Required when using merge_commit_message.

The default value for a merge commit title.

  • PR_TITLE - default to the pull request's title.
  • MERGE_MESSAGE - default to the classic title for a merge message (e.g., Merge pull request #123 from branch-name).

Possible values:

  • "PR_TITLE"
  • "MERGE_MESSAGE"
is_template Boolean No

Either true to make this repo available as a template repository or false to prevent it.

Default value: false

auto_init Boolean No

Pass true to create an initial commit with empty README.

Default value: false

allow_rebase_merge Boolean No

Either true to allow rebase-merging pull requests, or false to prevent rebase-merging.

Default value: true

has_projects Boolean No

Either true to enable projects for this repository or false to disable them. Note: If you're creating a repository in an organization that has disabled repository projects, the default is false, and if you pass true, the API returns an error.

Default value: true

gitignore_template String No

Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, "Haskell".

use_squash_pr_title_as_default Boolean No

Either true to allow squash-merge commits to use pull request title, or false to use commit message. **This property is closing down. Please use squash_merge_commit_title instead.

Default value: false

squash_merge_commit_message String No

The default value for a squash merge commit message:

  • PR_BODY - default to the pull request's body.
  • COMMIT_MESSAGES - default to the branch's commit messages.
  • BLANK - default to a blank commit message.

Possible values:

  • "BLANK"
  • "PR_BODY"
  • "COMMIT_MESSAGES"
has_issues Boolean No

Either true to enable issues for this repository or false to disable them.

Default value: true

squash_merge_commit_title String No

Required when using squash_merge_commit_message.

The default value for a squash merge commit title:

  • PR_TITLE - default to the pull request's title.
  • COMMIT_OR_PR_TITLE - default to the commit's title (if only one commit) or the pull request's title (when more than one commit).

Possible values:

  • "PR_TITLE"
  • "COMMIT_OR_PR_TITLE"
allow_squash_merge Boolean No

Either true to allow squash-merging pull requests, or false to prevent squash-merging.

Default value: true

delete_branch_on_merge Boolean No

Either true to allow automatically deleting head branches when pull requests are merged, or false to prevent automatic deletion. The authenticated user must be an organization owner to set this property to true.

Default value: false

visibility String No

The visibility of the repository.

Possible values:

  • "public"
  • "private"
homepage String No

A URL with more information about the repository.

name String Yes

The name of the repository.

allow_auto_merge Boolean No

Either true to allow auto-merge on pull requests, or false to disallow auto-merge.

Default value: false

private Boolean No

Whether the repository is private.

Default value: false

allow_merge_commit Boolean No

Either true to allow merging pull requests with a merge commit, or false to prevent merging pull requests with merge commits.

Default value: true

custom_properties Object No

The custom properties for the new repository. The keys are the custom property names, and the values are the corresponding custom property values.

has_downloads Boolean No

Whether downloads are enabled.

Default value: true

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.