sds/overcommit · error · Overcommit::Exceptions::GitConfigError

Unable to write to local repo git config: #{result.stderr}

Error message

Unable to write to local repo git config: #{result.stderr}

What it means

Error "Unable to write to local repo git config: #{result.stderr}" thrown in sds/overcommit.

Source

Thrown at lib/overcommit/configuration.rb:245

      # We don't cast since we want to allow anything to count as "true" except
      # a literal zero
      result.stdout.strip != '0'
    end

    # Update the currently stored signature for this hook.
    def update_signature!
      result = Overcommit::Utils.execute(
        %w[git config --local] + [signature_config_key, signature]
      )

      verify_signature_value = @hash['verify_signatures'] ? 1 : 0
      result &&= Overcommit::Utils.execute(
        %W[git config --local #{verify_signature_config_key} #{verify_signature_value}]
      )

      unless result.success?
        raise Overcommit::Exceptions::GitConfigError,
              "Unable to write to local repo git config: #{result.stderr}"
      end
    end

    protected

    attr_reader :hash

    private

    def ad_hoc_hook?(hook_context, hook_name)
      ad_hoc_conf = @hash.fetch(hook_context.hook_class_name) { {} }.fetch(hook_name) { {} }

      # Ad hoc hooks are neither built-in nor have a plugin file written but
      # still have a `command` specified to be run
      !built_in_hook?(hook_context, hook_name) &&
        !plugin_hook?(hook_context, hook_name) &&
        (ad_hoc_conf['command'] || ad_hoc_conf['required_executable'])

View on GitHub (pinned to fee0cd74b2)

Solutions

  1. Ensure `.git/config` is writable by the current user (check file permissions and ownership).
  2. Read the git stderr shown in the message for the specific failure (read-only filesystem, locked file, corrupt config).
  3. Run `git config --local --list` manually to confirm local config access works outside Overcommit.

When it happens

Trigger: Thrown at lib/overcommit/configuration.rb:245 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sds/overcommit@fee0cd74b2 (2026-08-23). Data as JSON: /api/errors/e2dc3e1a81d771a6. Report an issue: GitHub.