git
sparse_checkout
ai_generated
true
error: sparse-checkout is not enabled. Use 'git sparse-checkout init' to enable it.
ID: git/sparse-checkout-error
88%Fix Rate
90%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 2 | active | — | — | — |
Root Cause
Git sparse-checkout commands fail because sparse-checkout is not initialized, or cone mode patterns are incorrectly specified. Often seen when migrating from non-cone sparse-checkout to cone mode or in CI environments.
genericWorkarounds
-
90% success Initialize sparse-checkout properly with cone mode
Run git sparse-checkout init --cone, then git sparse-checkout set <directory1> <directory2> to specify which directories to include.
-
85% success Disable cone mode for complex patterns
Run git sparse-checkout init --no-cone if you need gitignore-style patterns. Then use git sparse-checkout set with pattern syntax.
Dead Ends
Common approaches that don't work:
-
Editing .git/info/sparse-checkout manually with non-cone patterns while cone mode is enabled
80% fail
Cone mode expects directory-based patterns; arbitrary gitignore-style patterns are silently ignored or cause errors
-
Running git read-tree -mu HEAD to force update the working tree
70% fail
This is the old sparse-checkout mechanism and conflicts with the new sparse-checkout command; it can leave the working tree in an inconsistent state
Error Chain
Leads to:
Preceded by:
Frequently confused with: