| git_config | R Documentation |
Get, set, or unset Git options, as git config does on the command line.
Global settings affect all of a user's Git operations
(git config --global), whereas local settings are scoped to a specific
repository (git config --local). When both exist, local options always win.
| local | global | |
| get all | git_config() | git_config_global() |
| get one (local+global) | git_config_get() | git_config_get() |
| get one (local or global only) | git_config_local_get() | git_config_global_get() |
| set | git_config_set() | git_config_global_set() |
| unset | git_config_unset() | git_config_global_unset() |
git_config(repo = ".")
git_config_global()
git_config_get(name, repo = ".")
git_config_local_get(name, repo = ".")
git_config_global_get(name)
git_config_set(name, value, add = FALSE, repo = ".")
git_config_global_set(name, value, add = FALSE)
git_config_unset(name, pattern = NULL, repo = ".")
git_config_global_unset(name, pattern = NULL)
repo |
The path to the git repository. If the directory is not a
repository, parent directories are considered (see |
name |
Name of the option to get or set |
value |
Value to set. Must be a string, logical, number or |
add |
if |
pattern |
optional regular expression, for matching values to unset in case of multiple values |
git_config(): a data.frame of the Git options "in force" in the context
of repo, one row per option. The level column reveals whether the
option is determined from global or local config.
git_config_global(): a data.frame, as for git_config(), except only
for global Git options.
git_config_get(): the value of the named option considering both local and
global config (local wins), or NULL if unset.
git_config_local_get(): as for git_config_get(), but restricted to
local (repository-level) config only.
git_config_global_get(): as for git_config_get(), but for global config only.
git_config_set(), git_config_global_set(): The previous value(s) of
name in local or global config, respectively. If this option was
previously unset, returns NULL. Returns invisibly.
git_config_unset(), git_config_global_unset(): The previous value(s) of
name that were unset. Returns invisibly.
All entries in the name column are automatically normalised to
lowercase (see
https://libgit2.org/libgit2/#HEAD/type/git_config_entry for details).
Other git:
git_archive,
git_branch(),
git_commit(),
git_diff(),
git_fetch(),
git_history,
git_ignore,
git_merge(),
git_rebase(),
git_remote,
git_repo,
git_reset(),
git_restore(),
git_revert(),
git_signature(),
git_stash,
git_tag,
git_worktree
# Set and inspect a local, custom Git option
r <- file.path(tempdir(), "gert-demo")
git_init(r)
previous <- git_config_set("aaa.bbb", "ccc", repo = r)
previous
git_config_local_get("aaa.bbb", repo = r)
previous <- git_config_set("aaa.bbb", NULL, repo = r)
previous
git_config_local_get("aaa.bbb", repo = r)
# Get a single named option (returns NULL if unset)
git_config_get("aaa.bbb", repo = r)
git_config_set("aaa.bbb", "ccc", repo = r)
git_config_get("aaa.bbb", repo = r)
unlink(r, recursive = TRUE)
## Not run:
# Set global Git options
git_config_global_set("user.name", "Your Name")
git_config_global_set("user.email", "your@email.com")
git_config_global()
# Get a single global option (returns NULL if unset)
git_config_global_get("user.name")
git_config_global_get("gert.nonexistent")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.