This Git warning occurs when sparse-checkout patterns don't match the expected format for cone mode. Git rejects complex glob patterns like '**/*.js' when cone mode is enabled. Switch to non-cone mode or use directory-based patterns to resolve this.
This warning appears when you configure `git sparse-checkout` with patterns that don't conform to cone mode's strict requirements. Cone mode, which is the default since Git 2.26, only accepts simple directory-based patterns, not the full gitignore-style patterns you might expect. When Git parses your sparse-checkout file with `core.sparseCheckoutCone=true`, it expects patterns in a specific format: directory paths that start with `/` and optionally end with `/`. Complex glob patterns like `**/*.csv`, `!exclude-dir/`, or patterns with wildcards in directory names are considered "unrecognized" because they don't fit cone mode's optimized path matching model. Git issues this warning because it cannot apply cone mode's performance optimizations to non-conforming patterns. Depending on your Git version, it may either fall back to slower pattern matching or ignore the problematic patterns entirely.
First, determine whether cone mode is enabled:
# Check if cone mode is active
git config core.sparseCheckoutCone
# List current patterns
git sparse-checkout list
# View the raw sparse-checkout file
cat .git/info/sparse-checkoutIf core.sparseCheckoutCone returns true (or is unset, as true is the default since Git 2.26), you're in cone mode and must use directory-only patterns.
Rewrite your patterns to use simple directory paths that work with cone mode:
# Correct cone mode patterns - only directories
git sparse-checkout set src docs lib
# With nested directories
git sparse-checkout set src/components src/utils tests/unit
# Add more directories later
git sparse-checkout add packages/coreCone mode rules:
- Patterns must be directory names (no file patterns)
- No glob wildcards (*, **, ?)
- No negation patterns (!)
- All files in the root directory are always included
This approach is faster because Git can use optimized bloom filter matching.
If you need glob patterns, wildcards, or exclusions, disable cone mode:
# Initialize sparse checkout in non-cone mode
git sparse-checkout init --no-cone
# Or disable cone mode on existing setup
git config core.sparseCheckoutCone false
# Now you can use gitignore-style patterns
git sparse-checkout set --no-cone '**/*.js' '**/*.ts' '!node_modules/'Non-cone mode pattern examples:
# Include only JavaScript files
git sparse-checkout set --no-cone '**/*.js'
# Exclude specific directories
git sparse-checkout set --no-cone '/*' '!/large-assets/' '!/vendor/'
# Combine multiple patterns
git sparse-checkout set --no-cone 'src/**' 'tests/**' '*.json' '!*.log'After changing modes, reapply the checkout:
git sparse-checkout reapplyNegative (exclusion) patterns require non-cone mode:
# This fails in cone mode:
# git sparse-checkout set --cone '/*' '!/big-directory/'
# Use non-cone mode instead:
git sparse-checkout init --no-cone
git sparse-checkout set --no-cone '/*' '!/big-directory/'Alternative: Use cone mode with directory whitelist:
Instead of excluding, explicitly include only what you need:
# Instead of excluding 'large-assets', include everything else
git sparse-checkout set src lib tests configThis is often more maintainable and gets the performance benefits of cone mode.
After modifying patterns, verify the configuration:
# List the configured patterns
git sparse-checkout list
# Check which files will be checked out (dry run)
git ls-tree -r HEAD --name-only | git check-ignore --stdin -v --no-index
# Reapply the sparse checkout
git sparse-checkout reapply
# Verify the working directory
ls -la
git statusIf files are still not appearing as expected:
# Force a fresh checkout
git read-tree -mu HEADIf sparse checkout is misconfigured, you can reset and start fresh:
# Disable sparse checkout entirely
git sparse-checkout disable
# This checks out all files and removes sparse-checkout config
# Verify everything is restored
git status
# Start over with a clean configuration
git sparse-checkout init --cone # or --no-cone
git sparse-checkout set your-directoriesTo completely remove sparse checkout configuration:
git sparse-checkout disable
rm .git/info/sparse-checkout
git config --unset core.sparseCheckout
git config --unset core.sparseCheckoutCone### Cone Mode vs Non-Cone Mode
| Feature | Cone Mode | Non-Cone Mode |
|---------|-----------|---------------|
| Pattern syntax | Directory names only | Full gitignore patterns |
| Performance | O(number of patterns) | O(patterns * paths) |
| Negation patterns | Not supported | Supported |
| Glob wildcards | Not supported | Fully supported |
| Sparse index | Compatible | Not compatible |
| Default since | Git 2.26 | Before Git 2.26 |
### Performance Implications
Cone mode uses bloom filters for path matching, making it significantly faster for large repositories. Non-cone mode must check every path against every pattern, which can slow down operations like git status and git checkout considerably in repositories with many files.
For a repository with 100,000 files and 50 patterns:
- Cone mode: ~50 pattern checks (directory-based)
- Non-cone mode: Up to 5,000,000 pattern matches
### Sparse Index Feature
Git 2.32+ introduced the sparse index feature for even better performance:
# Only works with cone mode
git config index.sparse trueThis reduces the size of the index file by not including entries for files outside the sparse checkout, but it's incompatible with non-cone mode.
### Editing the Sparse-Checkout File Directly
You can manually edit .git/info/sparse-checkout, but be careful:
# Cone mode expects patterns like:
/path/to/dir/
# Non-cone mode accepts gitignore patterns:
*.txt
!secret.txt
/docs/**After editing, run git sparse-checkout reapply.
### Git Version Compatibility
- Git 2.25: sparse-checkout command introduced
- Git 2.26: Cone mode becomes default
- Git 2.32: Sparse index feature added
- Git 2.37: Improved warning messages
Older scripts that worked with pre-2.26 Git may need --no-cone added.
### CI/CD Considerations
When using sparse checkout in CI pipelines:
# GitHub Actions example
- uses: actions/checkout@v4
with:
sparse-checkout: |
src
tests
package.json
sparse-checkout-cone-mode: trueMany CI systems default to cone mode. Use the appropriate option to switch modes if needed.
### Partial Clone + Sparse Checkout
For maximum efficiency with large repositories, combine with partial clone:
# Clone with blob filter (don't download file contents)
git clone --filter=blob:none --sparse https://github.com/user/repo
# Then set sparse checkout
cd repo
git sparse-checkout set src libThis downloads only the Git objects you actually need.
warning: BOM detected in file, this may cause issues
UTF-8 Byte Order Mark (BOM) detected in file
fatal: Server does not support --shallow-exclude
Server does not support --shallow-exclude
warning: filtering out blobs larger than limit
Git partial clone filtering large blobs warning
fatal: Server does not support --shallow-since
Server does not support --shallow-since in Git
kex_exchange_identification: Connection closed by remote host
Connection closed by remote host when connecting to Git server