libgit2

git_repository_init

Version:

Creates a new Git repository in the given folder.

TODO: - Reinit the repository

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_init(git_repository **out, const char *path, unsigned int is_bare);

Parameters

Out
out

pointer to the repo which will be created or reinitialized

const char *
In
path

the path to the repository

unsigned int
In
is_bare

if true, a Git repository without a working directory is created at the pointed path. If false, provided path will be considered as the working directory into which the .git directory will be created.

Returns

int

0 or an error code

Versions