libgit2

git_repository_open

Version:

Open a git repository.

The 'path' argument must point to an existing git repository folder, e.g.

/path/to/my_repo/.git/ (normal repository) objects/ index HEAD

/path/to/bare_repo/ (bare repository) objects/ index HEAD

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

Signature

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

Parameters

In
repository

pointer to the repo which will be opened

const char *
In
path

the path to the repository

Returns

int

the new repository handle; NULL on error

Versions