libgit2

git_repository_config

Version:

Retrieve the relevant configuration for a repository

If either the global_config_path or system_config_path variables are not NULL, the given config files will be also included in the configuration set. The global configuration file is located in $HOME/.gitconfig. On most UNIX systems, the system config file file may be found on $sysconfdir/gitconfig.

The resulting git_config instance will query the files in the following order:

  • Repository configuration file
    • Global configuration file
    • System configuration file

The method will fail if any of the given config files can't be found or accessed.

The returned git_config instance is owned by the caller and must be manually free'd once it's no longer on use.

Signature

int git_repository_config(git_config **out, git_repository *repo, const char *global_config_path, const char *system_config_path);

Parameters

In
out

the repository's configuration

In
repo

the repository for which to get the config

const char *
In
global_config_path
const char *
In
system_config_path

Path to the global config file

Returns

int

Versions