Clones a Git repository.


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


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.


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


Copy-GitRepository -Uri '' -DestinationPath LibGit2.PowerShell