`git commit` fails with `[ERROR] Your pre-commit configuration is unstaged. git add .pre-commit-config.yaml to fix this.`
IntermediateTroubleshootingSubmodules, LFS and Hooks
Answer
Likely causes → The pre-commit framework requires its config to be staged, because it stashes unstaged changes while running hooks and needs a consistent config.
Diagnose → git status -- .pre-commit-config.yaml
Fix → git add .pre-commit-config.yaml and commit again. If you intentionally do not want to commit it yet, stash your config change or temporarily skip with SKIP=hook-id git commit.
Prevent → Commit pre-commit config changes in their own commit, and run pre-commit run --all-files after changing hook versions (pre-commit autoupdate).
More on Submodules, LFS and Hooks
`fatal: No url found for submodule path 'libs/common' in .gitmodules`IntermediateAfter cloning, the submodule directories exist but are empty.Beginner`git submodule update` fails: `fatal: remote error: upload-pack: not our ref 3f2a9c1...` and `Fetched in submodule path 'libs/common', but it did not contain 3f2a9c1. Direct fetching of that commit failed.`Intermediate`git status` keeps showing `modified: libs/common (new commits)` even though you never touched it.BeginnerYou committed inside a submodule, ran `git submodule update`, and your commits vanished.Intermediate`git submodule add` fails with `fatal: 'libs/common' already exists in the index`.Intermediate