libgit2

git_repository_open

Version:

Open a git repository.

The 'path' argument must point to either a git repository folder, or an existing work dir.

The method will automatically detect if 'path' is a normal or bare repository or fail is 'path' is neither.

Note that the libgit2 library must be initialized using git_libgit2_init before any APIs can be called, including this one.

Signature

int git_repository_open(git_repository **out, const char *path);

Parameters

Out
out

pointer to the repo which will be opened

const char *
In
path

the path to the repository

Returns

int

0 or an error code

Versions