{"record":{"id":"ae500e44e20b558a","repo":"sds/overcommit","slug":"unable-to-read-from-local-repo-git-config-resul-ae500e","errorCode":null,"errorMessage":"Unable to read from local repo git config: #{result.stderr}","messagePattern":"Unable to read from local repo git config: #(.+?)","errorType":"exception","errorClass":"Overcommit::Exceptions::GitConfigError","httpStatus":null,"severity":"error","filePath":"lib/overcommit/hook_signer.rb","lineNumber":113,"sourceCode":"          hook_contents\n        end\n\n      Digest::SHA256.hexdigest(content_to_sign.to_s + hook_config.to_s)\n    end\n\n    def hook_contents\n      File.read(hook_path)\n    end\n\n    def stored_signature\n      result = Overcommit::Utils.execute(\n        %w[git config --local --get] + [signature_config_key]\n      )\n\n      if result.status == 1 # Key doesn't exist\n        return ''\n      elsif result.status != 0\n        raise Overcommit::Exceptions::GitConfigError,\n              \"Unable to read from local repo git config: #{result.stderr}\"\n      end\n\n      result.stdout.chomp\n    end\n\n    def signature_config_key\n      \"overcommit.#{@context.hook_class_name}.#{@hook_name}.signature\"\n    end\n  end\nend\n","sourceCodeStart":95,"sourceCodeEnd":125,"githubUrl":"https://github.com/sds/overcommit/blob/fee0cd74b26eb81f64b43b7fab17bbb541575cc4/lib/overcommit/hook_signer.rb#L95-L125","documentation":"HookSigner#stored_signature reads the plugin signature with 'git config --local --get overcommit.<HookType>.<Hook>.signature'. Exit status 1 (key absent) is normal and returns an empty string, but any other non-zero exit raises GitConfigError with git's stderr - git could not read or parse the local config at all. This runs on every hook invocation because the runner compares stored and computed signatures.","triggerScenarios":"git exits non-zero (typically 128) with 'bad config line N in .git/config' (corrupted config or unresolved conflict markers), 'not in a git directory' when run outside a valid work tree, or permission errors reading .git/config.","commonSituations":"Hand-edited .git/config with a typo; merge/submodule trouble left conflict markers in .git/config; hooks invoked with GIT_DIR pointing at a broken path; CI checkouts where .git is mangled.","solutions":["Reproduce with 'git config --local --list' - it names the offending line; fix or remove that line in .git/config","If the file is unfixable, re-create the essentials (remotes, user settings) and re-run 'overcommit --sign' to rewrite the signature keys","Verify you are inside the repo: 'git rev-parse --git-dir' must print a path; re-run hooks from the repo root","Re-run the hook or 'overcommit --sign <hook-type>' once the config parses again"],"exampleFix":"# before (.git/config contains)\n[core]\n    repositoryformatversion <<<<<<< HEAD\n\n# after\n[core]\n    repositoryformatversion = 0","handlingStrategy":"validation","validationCode":"def git_config_parseable?\n  system('git', 'config', '--local', '--list', out: File::NULL, err: File::NULL)\nend\n\nabort '.git/config is not parseable - fix it before running hooks' unless git_config_parseable?","typeGuard":null,"tryCatchPattern":"begin\n  runner.run\nrescue Overcommit::Exceptions::GitConfigError => e\n  warn \"Cannot read git config: #{e.message}\"\n  warn 'Run: git config --local --list  # shows the offending line'\n  exit 1\nend","preventionTips":["Set config values via 'git config' commands instead of editing .git/config by hand","After merge/rebase trouble, sanity-check 'git config --local --list' before committing","Never leave conflict markers anywhere under .git"],"tags":["git","git-config","corrupt-config","overcommit"],"backgroundTag":"git-config-read-failed","analyzedSha":"fee0cd74b26eb81f64b43b7fab17bbb541575cc4","analyzedAt":"2026-08-23T04:07:28.153Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}