git_config

May 7, 2026 ยท View on GitHub

The git_config resource manages the configuration of Git client on a machine.

Actions

ActionDescription
:setSets a Git config key to the requested value. Default.
:unsetRemoves all values for a Git config key in the requested scope.

Properties

PropertyTypeDefaultDescription
keyStringname propertyGit configuration key.
valueStringnilGit configuration value. Required for :set.
scopeString'global'Config scope: local, global, system, or file.
config_fileStringnilConfig file used with scope 'file'.
pathStringnilWorking directory for local config operations.
userStringnilUser for the git config command.
groupStringnilGroup for the git config command.
passwordStringnilPassword for Windows elevated execution. Sensitive.
optionsStringnilAdditional options appended to the set command, such as --add.

Examples

Set a system value

git_config 'url.https://github.com/.insteadOf' do
  value 'git://github.com/'
  scope 'system'
  options '--add'
end

Unset a global value

git_config 'user.name' do
  action :unset
end