New GitHubRepositoryFromTemplate - X-Guardian/PowerShellForGitHub GitHub Wiki

New-GitHubRepositoryFromTemplate

SYNOPSIS

Creates a new repository on GitHub from a template repository.

SYNTAX

Elements

New-GitHubRepositoryFromTemplate [-OwnerName <String>] [-RepositoryName] <String> [-TargetOwnerName] <String>
 [-TargetRepositoryName] <String> [-Description <String>] [-Private] [-AccessToken <String>] [-NoStatus]
 [-WhatIf] [-Confirm] [<CommonParameters>]

Uri

New-GitHubRepositoryFromTemplate [-Uri] <String> [-TargetOwnerName] <String> [-TargetRepositoryName] <String>
 [-Description <String>] [-Private] [-AccessToken <String>] [-NoStatus] [-WhatIf] [-Confirm]
 [<CommonParameters>]

DESCRIPTION

Creates a new repository on GitHub from a template repository.

The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub

EXAMPLES

EXAMPLE 1

New-GitHubRepositoryFromTemplate -OwnerName MyOrg -RepositoryName MyTemplateRepo -TargetRepositoryName MyNewRepo -TargetOwnerName Me

Creates a new GitHub repository from the specified template repository.

EXAMPLE 2

$repo = Get-GitHubRepository -OwnerName MyOrg -RepositoryName MyTemplateRepo

$repo | New-GitHubRepositoryFromTemplate -TargetRepositoryName MyNewRepo -TargetOwnerName Me

You can also pipe in a repo that was returned from a previous command.

PARAMETERS

-AccessToken

If provided, this will be used as the AccessToken for authentication with the REST Api. Otherwise, will attempt to use the configured value or will run unauthenticated.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Description

A short description of the repository.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-NoStatus

If this switch is specified, long-running commands will run on the main thread with no commandline status update. When not specified, those commands run in the background, enabling the command prompt to provide status information. If not supplied here, the DefaultNoStatus configuration property value will be used.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-OwnerName

Owner of the template repository. If no value is specified, the DefaultOwnerName configuration property value will be used, and if there is no configuration value defined, the current authenticated user will be used.

Type: System.String
Parameter Sets: Elements
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Private

By default, this repository will created Public. Specify this to create a private repository.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-RepositoryName

Name of the template repository.

Type: System.String
Parameter Sets: Elements
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-TargetOwnerName

The organization or person who will own the new repository. To create a new repository in an organization, the authenticated user must be a member of the specified organization.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-TargetRepositoryName

Name of the repository to be created.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Uri

Uri for the repository. The OwnerName and RepositoryName will be extracted from here instead of needing to provide them individually.

Type: System.String
Parameter Sets: Uri
Aliases: RepositoryUrl

Required: True
Position: 3
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

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

INPUTS

GitHub.Branch

GitHub.Content

GitHub.Event

GitHub.Issue

GitHub.IssueComment

GitHub.Label

GitHub.Milestone

GitHub.PullRequest

GitHub.Project

GitHub.ProjectCard

GitHub.ProjectColumn

GitHub.Release

GitHub.Repository

OUTPUTS

GitHub.Repository

NOTES

The authenticated user must own or be a member of an organization that owns the repository.

To check if a repository is available to use as a template, call `Get-GitHubRepository` on the repository in question and check that the is_template property is $true.

RELATED LINKS

⚠️ **GitHub.com Fallback** ⚠️