usethis (version 1.3.0)

use_git_config: Configure Git

Description

Sets Git options, for either the user or the project ("global" or "local", in Git terminology). The mandate is currently very narrow: to manage the user name and email. The scope argument is consulted when writing. When reading, use_git_config() ignores scope and simply reports the options in effect, where local config overrides global, if present. Use git2r::config() directly or the command line for general Git configuration.

Usage

use_git_config(scope = c("user", "project"), ...)

Arguments

scope

Edit globally for the current user, or locally for the current project

...

Additional options to write or delete from the configuration.

Value

A list with components user.name and user.email.

See Also

Other git helpers: use_git_hook, use_git_ignore, use_git

Examples

Run this code
# NOT RUN {
## see if user name and email are currently configured
use_git_config()

## set the user's global user.name and user.email
use_git_config(user.name = "Jane", user.email = "jane@example.org")

## set the user.name and user.email locally, i.e. for current repo/project
use_git_config(
  scope = "project",
  user.name = "Jane",
  user.email = "jane@example.org"
)
# }

Run the code above in your browser using DataCamp Workspace