sds/overcommit · error · RuntimeError
Unable to access git tree
Error message
Unable to access git tree
What it means
Error "Unable to access git tree" thrown in sds/overcommit.
Source
Thrown at lib/overcommit/hook/pre_commit/execute_permissions.rb:48
extract_from_git_index(file_modes)
file_modes.map do |file, mode|
next unless execute_permissions?(mode)
Overcommit::Hook::Message.new(
:error,
file,
nil,
"File #{file} has unnecessary execute permissions",
)
end.compact
end
private
def extract_from_git_tree(file_modes)
result = execute(%w[git ls-tree HEAD --], args: applicable_files)
raise 'Unable to access git tree' unless result.success?
result.stdout.split("\n").each do |line|
mode, _type, _hash, file = line.split(/\s+/, 4)
file_modes[file] = mode
end
end
def extract_from_git_index(file_modes)
result = execute(%w[git diff --raw --cached --no-color --], args: applicable_files)
raise 'Unable to access git index' unless result.success?
result.stdout.split("\n").each do |line|
_old_mode, new_mode, _old_hash, _new_hash, _status, file = line.split(/\s+/, 6)
file_modes[file] = new_mode
end
end
# Check if the 1st bit is toggled, indicating execute permissions.View on GitHub (pinned to fee0cd74b2)
Solutions
- Ensure the hook runs inside a valid git repository with a readable HEAD tree; run `git ls-tree HEAD` to verify.
- If HEAD does not exist yet (no commits), make an initial commit or disable the ExecutePermissions hook until one exists.
When it happens
Trigger: Thrown at lib/overcommit/hook/pre_commit/execute_permissions.rb:48 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/7eef798c30a203ea.
Report an issue: GitHub.