< Back

New-Repo

Mon Jan 13, 2020 8:33 pm

NAME New-Repo



SYNOPSIS

Creates a new local repository with the provided name.





SYNTAX

New-Repo [-Repo] <String> [[-Service] <String>] [[-Path] <String>] [-Open] [[-GitIgnore] <String>]

[<CommonParameters>]





DESCRIPTION

Used to quickly bootstrap a local repository by automatically creating the correct

folder structure, configuring your Git remotes and optionally adding a relevant gitignore

file. Upon completion, you may switch to the location of the newly created repo by either

passing the -Open flag or by using Open-Repo.





PARAMETERS

-Repo <String>

The name of the repository which you would like to fetch.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Service <String>

The remote hosting provider from which you would like to fetch the repository.



Required? false

Position? 2

Default value $GitTool.Service

Accept pipeline input? false

Accept wildcard characters? false



-Path <String>

The directory within which all of your repositories are stored. Defaults to the value of $GitTool.Directory

if not specified.



Required? false

Position? 3

Default value $GitTool.Directory

Accept pipeline input? false

Accept wildcard characters? false



-Open [<SwitchParameter>]

Whether you would like to reconfigure the local repository to use the updated remote address in situations

where that has changed.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-GitIgnore <String>

The language or tool for which you would like to fetch a gitignore file. If not provided, defaults to your

globally configured

$GitTool.GitIgnore.Default option.



Required? false

Position? 4

Default value $GitTool.GitIgnore.Default

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>New-Repo sierrasoftworks/git-tool



Running git init

Running git remote add origin git@github.com:SierraSoftworks/git-tool.git



Name Value

---- -----

WebURL https://github.com/SierraSoftworks/git-tool

Service github.com

Repo SierraSoftworks/git-tool

Path C:\\dev\\github.com\\SierraSoftworks\\git-tool

Exists True

GitURL git@github.com:SierraSoftworks/git-tool.git









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>New-Repo sierrasoftworks/git-tool -GitIgnore powershell



Running git init

Running git remote add origin git@github.com:SierraSoftworks/git-tool.git

Adding .gitignore file



Name Value

---- -----

WebURL https://github.com/SierraSoftworks/git-tool

Service github.com

Repo SierraSoftworks/git-tool

Path C:\\dev\\github.com\\SierraSoftworks\\git-tool

Exists True

GitURL git@github.com:SierraSoftworks/git-tool.git











RELATED LINKS