Method: RHC::GitHelpers#git_config_set

Defined in:
lib/rhc/git_helpers.rb

#git_config_set(key, value) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/rhc/git_helpers.rb', line 57

def git_config_set(key, value)
  unset_cmd = "git config --unset-all #{key}"
  config_cmd = "git config --add #{key} #{value}"
  debug "Adding #{key} = #{value} to git config"
  commands = [unset_cmd, config_cmd]
  commands.each do |cmd|
    debug "Running #{cmd} 2>&1"
    output = %x[#{cmd} 2>&1]
    raise RHC::GitException, "Error while adding config values to git - #{output}" unless output.empty?
  end
end