New-GitRepository

Creates a new Git repository.

Syntax

New-GitRepository [-Path] <String> [-WhatIf] [-Confirm] [<CommonParameters>]

Description

The New-GitRepository function creates a new Git repository. The Path parameter should be set to a directory path. If the path does not exist, it is created and that directory becomes the new repository's root. If the path does exist, it also becomes the root of a new repository. If the path exists and it is already a repository, nothing happens.

Parameters

Name Type Description Required? Pipeline Input Default Value
Path String

The path to the repository to create.

true false
WhatIf SwitchParameter false false
Confirm SwitchParameter false false
CommonParameters This cmdlet supports common parameters. For more information type
Get-Help about_CommonParameters.

Return Values

LibGit2.Automation.RepositoryInfo.

EXAMPLE 1

New-GitRepository -Path 'C:\Projects\MyCoolNewRepo'

Demonstrates how to create a new Git repository. In this case, a new repository is created in `C:\Projects\MyCoolNewRepo'.