Set-GitHubRepository

SYNOPSIS

Update a repository

SYNTAX

__AllParameterSets

Set-GitHubRepository [-Owner] <string> [-Repo] <string> [-Name <string>] [-Description <string>]
 [-Homepage <string>] [-Private] [-Visibility <string>] [-SecurityAndAnalysis <Object>] [-HasIssues]
 [-HasProjects] [-HasWiki] [-HasPullRequests] [-PullRequestCreationPolicy <string>] [-IsTemplate]
 [-DefaultBranch <string>] [-AllowSquashMerge] [-AllowMergeCommit] [-AllowRebaseMerge]
 [-AllowAutoMerge] [-DeleteBranchOnMerge] [-AllowUpdateBranch] [-UseSquashPrTitleAsDefault]
 [-SquashMergeCommitTitle <string>] [-SquashMergeCommitMessage <string>]
 [-MergeCommitTitle <string>] [-MergeCommitMessage <string>] [-Archived] [-AllowForking]
 [-WebCommitSignoffRequired] [-Body <Object>] [-Accept <string>] [-WhatIf] [-Confirm]

ALIASES

This cmdlet has the following aliases,

  • Get-GHSetRepository

DESCRIPTION

The Set-GitHubRepository cmdlet invokes the PATCH method of the /repos/{owner}/{repo} endpoint (Update a repository)

Note: To edit a repository’s topics, use the Replace all repository topics (https://docs.github.com/rest/repos/repos#replace-all-repository-topics) endpoint.

Endpoint: PATCH /repos/{owner}/{repo} API version: 2026-03-10

EXAMPLES

EXAMPLE 1

Set-GitHubRepository -Owner 'octocat' -Repo 'Hello-World'

Invokes PATCH /repos/{owner}/{repo}

EXAMPLE 2

Set-GitHubRepository -Owner 'octocat' -Repo 'Hello-World' -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: ''

-AllowForking

Either ‘true’ to allow private forks, or ‘false’ to prevent private forks.

Body property [ allow_forking ]

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

-AllowUpdateBranch

Either ‘true’ to always allow a pull request head branch that is behind its base branch to be updated even if it is not required to be up to date before merging, or false otherwise.

Body property [ allow_update_branch ]

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

-Archived

Whether to archive this repository. ‘false’ will unarchive a previously archived repository.

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: (All)
  Position: Named
  IsRequired: false
  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: ''

-DefaultBranch

Updates the default branch for this repository.

Body property [ default_branch ]

Type: System.String
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.

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

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

-HasPullRequests

Either ‘true’ to allow pull requests for this repository or ‘false’ to prevent pull requests.

Body property [ has_pull_requests ]

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

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

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

-Owner

The account owner of the repository. The name is not case sensitive.

Path parameter [ owner ]

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

Either ‘true’ to make the repository private or ‘false’ to make it public. Default: ‘false’. Note: You will get a ‘422’ error if the organization restricts changing repository visibility (https://docs.github.com/articles/repository-permission-levels-for-an-organization#changing-the-visibility-of-repositories) to organization owners and a non-owner tries to change the value of 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: ''

-PullRequestCreationPolicy

The policy that controls who can create pull requests for this repository: ‘all’ or ‘collaborators_only’.

Body property [ pull_request_creation_policy ]

Allowed values: ‘all’, ‘collaborators_only’

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

-Repo

The name of the repository without the ‘.git’ extension. The name is not case sensitive.

Path parameter [ repo ]

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

-SecurityAndAnalysis

Specify which security and analysis features to enable or disable for the repository.

To use this parameter, you must have admin permissions for the repository or be an owner or security manager for the organization that owns the repository. For more information, see “Managing security managers in your organization (https://docs.github.com/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization).”

For example, to enable GitHub Advanced Security, use this data in the body of the ‘PATCH’ request: ‘{ “security_and_analysis”: {“advanced_security”: { “status”: “enabled” } } }’.

You can check which security and analysis features are currently enabled by using a ‘GET /repos/{owner}/{repo}’ request.

Body property [ security_and_analysis ]

Type: System.Object
DefaultValue: ''
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: ''

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

-WebCommitSignoffRequired

Either ‘true’ to require contributors to sign off on web-based commits, or ‘false’ to not require contributors to sign off on web-based commits.

Body property [ web_commit_signoff_required ]

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

-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/update Category: repos / repos