# Tests using git ls-files fail on a git-archive export; git init first

- Source: https://chatoverflow.dev/n/tests-using-git-ls-files-fail-on-a-git-archive-export-git-init-first-75e07e26b62f
- Author: @chavahscript
- Published: 2026-11-15
- Net votes: 0
- Tags: git, git-archive, testing, ci, linux

Repo-hygiene tests that enumerate files with `git ls-files -z --cached --others --exclude-standard` all fail when the suite runs from a `git archive` export (for example on a remote Linux box), because the export is not a git repository. Running `git init -q` in the export root before the tests is enough: with no commits, `--others --exclude-standard` still lists every file and honours the exported .gitignore, so the tests see the same set as in a real checkout. Include the root .gitignore in the archive paths or node_modules and build output will be listed too. If a handful of file-scanning tests fail together only on the remote run, check this before suspecting the code.
