New-GitHubRepositoryInOrg

SYNOPSIS

Create an organization repository

SYNTAX

Default (Default)

New-GitHubRepositoryInOrg [-Org] <string> -Name <string> [-Description <string>]
 [-Homepage <string>] [-Private] [-Visibility <string>] [-HasIssues] [-HasProjects] [-HasWiki]
 [-HasDownloads] [-IsTemplate] [-TeamId <long>] [-AutoInit] [-GitignoreTemplate <string>]
 [-LicenseTemplate <string>] [-AllowSquashMerge] [-AllowMergeCommit] [-AllowRebaseMerge]
 [-AllowAutoMerge] [-DeleteBranchOnMerge] [-UseSquashPrTitleAsDefault]
 [-SquashMergeCommitTitle <string>] [-SquashMergeCommitMessage <string>]
 [-MergeCommitTitle <string>] [-MergeCommitMessage <string>] [-CustomProperties <Object>]
 [-Accept <string>] [-WhatIf] [-Confirm]

Body

New-GitHubRepositoryInOrg [-Org] <string> -Body <Object> [-Name <string>] [-Description <string>]
 [-Homepage <string>] [-Private] [-Visibility <string>] [-HasIssues] [-HasProjects] [-HasWiki]
 [-HasDownloads] [-IsTemplate] [-TeamId <long>] [-AutoInit] [-GitignoreTemplate <string>]
 [-LicenseTemplate <string>] [-AllowSquashMerge] [-AllowMergeCommit] [-AllowRebaseMerge]
 [-AllowAutoMerge] [-DeleteBranchOnMerge] [-UseSquashPrTitleAsDefault]
 [-SquashMergeCommitTitle <string>] [-SquashMergeCommitMessage <string>]
 [-MergeCommitTitle <string>] [-MergeCommitMessage <string>] [-CustomProperties <Object>]
 [-Accept <string>] [-WhatIf] [-Confirm]

ALIASES

This cmdlet has the following aliases,

  • Get-GHNewRepositoryInOrg

DESCRIPTION

The New-GitHubRepositoryInOrg cmdlet invokes the POST method of the /orgs/{org}/repos endpoint (Create an organization repository)

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.

Endpoint: POST /orgs/{org}/repos API version: 2026-03-10

EXAMPLES

EXAMPLE 1

New-GitHubRepositoryInOrg -Org 'github' -Name 'Hello-World' -Body @{ key = 'value' }

Invokes POST /orgs/{org}/repos

EXAMPLE 2

New-GitHubRepositoryInOrg -Org 'github' -Body @{ name = 'Hello-World' }

Sends the request body from a hashtable, parameters override the keys of -Body

PARAMETERS

-Accept

The Accept header (media type) of the request Default value: application/vnd.github+json

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-AllowAutoMerge

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

Body property [ allow_auto_merge ]

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-AllowMergeCommit

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

Body property [ allow_merge_commit ]

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-AllowRebaseMerge

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

Body property [ allow_rebase_merge ]

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-AllowSquashMerge

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

Body property [ allow_squash_merge ]

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-AutoInit

Pass ‘true’ to create an initial commit with empty README.

Body property [ auto_init ]

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Body

The whole request body as a hashtable or object. Keys that are also available as parameters are overwritten by the parameter values

Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Body
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- cf
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-CustomProperties

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

Body property [ custom_properties ]

Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-DeleteBranchOnMerge

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’.

Body property [ delete_branch_on_merge ]

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Description

A short description of the repository.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-GitignoreTemplate

Desired language or platform .gitignore template (https://github.com/github/gitignore) to apply. Use the name of the template without the extension. For example, “Haskell”.

Body property [ gitignore_template ]

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-HasDownloads

Whether downloads are enabled.

Body property [ has_downloads ]

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-HasIssues

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

Body property [ has_issues ]

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-HasProjects

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.

Body property [ has_projects ]

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-HasWiki

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

Body property [ has_wiki ]

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Homepage

A URL with more information about the repository.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-IsTemplate

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

Body property [ is_template ]

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-LicenseTemplate

Choose an open source license template (https://choosealicense.com/) that best suits your needs, and then use the license keyword (https://docs.github.com/articles/licensing-a-repository/#searching-github-by-license-type) as the ‘license_template’ string. For example, “mit” or “mpl-2.0”.

Body property [ license_template ]

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-MergeCommitMessage

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.

Body property [ merge_commit_message ]

Allowed values: ‘PR_BODY’, ‘PR_TITLE’, ‘BLANK’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-MergeCommitTitle

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).

Body property [ merge_commit_title ]

Allowed values: ‘PR_TITLE’, ‘MERGE_MESSAGE’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Name

The name of the repository.

Required unless -Body is used

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Body
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
- Name: Default
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Org

The organization name. The name is not case sensitive.

Path parameter [ org ]

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Private

Whether the repository is private.

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SquashMergeCommitMessage

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.

Body property [ squash_merge_commit_message ]

Allowed values: ‘PR_BODY’, ‘COMMIT_MESSAGES’, ‘BLANK’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-SquashMergeCommitTitle

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).

Body property [ squash_merge_commit_title ]

Allowed values: ‘PR_TITLE’, ‘COMMIT_OR_PR_TITLE’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-TeamId

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

Body property [ team_id ]

Type: System.Int64
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-UseSquashPrTitleAsDefault

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.

Body property [ use_squash_pr_title_as_default ]

This property is deprecated

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Visibility

The visibility of the repository.

Allowed values: ‘public’, ‘private’

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-WhatIf

Runs the command in a mode that only reports what would happen without performing the actions.

Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- wi
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

Objects with properties named like the path parameters can be piped to this function

{{ Fill in the Description }}

System.String

{{ Fill in the Description }}

OUTPUTS

The response of the GitHub API (objects

{{ Fill in the Description }}

NOTES

OperationId: repos/create-in-org Category: repos / repos