New-GitHubRepositoryForAuthenticatedUser

SYNOPSIS

Create a repository for the authenticated user

SYNTAX

Default (Default)

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

Body

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

ALIASES

This cmdlet has the following aliases,

  • Get-GHNewRepositoryForAuthenticatedUser

DESCRIPTION

The New-GitHubRepositoryForAuthenticatedUser cmdlet invokes the POST method of the /user/repos endpoint (Create a repository for the authenticated user)

Creates a new repository for the authenticated user.

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 /user/repos API version: 2026-03-10

EXAMPLES

EXAMPLE 1

New-GitHubRepositoryForAuthenticatedUser -Name 'Hello-World' -Body @{ key = 'value' }

Invokes POST /user/repos

EXAMPLE 2

New-GitHubRepositoryForAuthenticatedUser -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

Whether to allow Auto-merge to be used on pull requests.

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

Whether to allow merge commits for pull requests.

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

Whether to allow rebase merges for pull requests.

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

Whether to allow squash merges for pull requests.

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

Whether the repository is initialized with a minimal 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: ''

-DeleteBranchOnMerge

Whether to delete head branches when pull requests are merged

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

The desired language or platform to apply to the .gitignore.

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: ''

-HasDiscussions

Whether discussions are enabled.

Body property [ has_discussions ]

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: ''

-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

Whether issues are enabled.

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

Whether projects are enabled.

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

Whether the wiki is enabled.

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

Whether this repository acts as a template that can be used to generate new repositories.

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

The license keyword of the open source license for this repository.

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: ''

-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: ''

-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 }}

OUTPUTS

The response of the GitHub API (objects

{{ Fill in the Description }}

NOTES

OperationId: repos/create-for-authenticated-user Category: repos / repos