Interview Prep/Git & GitHub/Config, Line Endings, Files and Platform Quirks

Checkout on Windows fails with `error: invalid path 'logs/2024-01-01T10:00:00.log'` (or `'docs/aux.md'`) and `fatal: unable to checkout working tree`.

IntermediateTroubleshootingConfig, Line Endings, Files and Platform Quirks
Answer

Likely causes → The repo contains paths that are illegal on NTFS: characters such as : * ? " < > |, trailing dots or spaces, or reserved device names (CON, PRN, AUX, NUL, COM1). Git for Windows refuses them (core.protectNTFS) for safety.

Diagnose → git ls-tree -r --name-only HEAD | grep -E '[:*?"<>|]|(^|/)(con|prn|aux|nul|com[0-9]|lpt[0-9])(\.|/|$)'

Fix → Rename the files from Linux, macOS or WSL and push:

git mv 'logs/2024-01-01T10:00:00.log' 'logs/2024-01-01T10-00-00.log'
git commit -m "Use Windows-safe file names" && git push

To work in the meantime, exclude the path with sparse checkout. Don't disable core.protectNTFS — it guards against real path-traversal CVEs.

Prevent → Add a CI check that rejects Windows-invalid paths if any contributor uses Windows.

All Git & GitHub questions Roadmap: Git & GitHub

More on Config, Line Endings, Files and Platform Quirks