Copy-GitRepository

Clones a Git repository.

Syntax

Copy-GitRepository [-Source] <String> [-DestinationPath] <String> [[-Credential] <PSCredential>] [-PassThru] [<CommonParameters>]

Description

The Copy-GitRepository function clones a Git repository from the URL specified by Uri to the path specified by DestinationPath and checks out the master branch. If the repository requires authentication, pass the username/password via the Credential parameter.

To clone a local repository, pass a file system path to the Uri parameter.

Parameters

Name Type Description Required? Pipeline Input Default Value
Source String

The URI or path to the source repository to clone.

true false
DestinationPath String

The directory where the repository should be cloned to. Must not exist or be empty.

true false
Credential PSCredential

The credentials to use to connect to the source repository.

false false
PassThru SwitchParameter

Returns a System.IO.DirectoryInfo object for the new copy's .git directory.

false false False

EXAMPLE 1

Copy-GitRepository -Uri 'https://github.com/splatteredbits/LibGit2.PowerShell' -DestinationPath LibGit2.PowerShell