Searches a directory and its parents for a Git repository.
Find-GitRepository [[-Path] <String>] [-Verify] [<CommonParameters>]
Find-GitRepository function searches a directory for a Git repository and returns a
LibGit2Sharp.Repository object representing that repository. If a repository isn't found, it looks up the directory tree until it finds one (i.e. it looks at the directories parent directory, then that directory's parent, then that directory's parent, etc. until it finds a repository or gets to the root directory. If it doesn't find one, nothing is returned.
With no parameters, looks in the current directory and up its directory tree. If given a path with the
Path parameter, it looks in that directory then up its directory tree.
The repository object that is returned contains resources that don't get automatically removed from memory by .NET. To avoid memory leaks, you must call its
Dispose() method when you're done using it.
|Name||Type||Description||Required?||Pipeline Input||Default Value|
The path to start searching.
Write an error if a repository isn't found. Usually, no error is written and nothing is returned when a repository isn't found.
Demonstrates how to find the Git repository of the current directory.
Find-GitRepository -Path 'C:\Projects\LibGit2.PowerShell\LibGit2\bin'
Demonstrates how to find the Git repository that a specific directory is a part of. In this case, a
LibGit2Sharp.Repository object is returned for the repository at