# git doesn't track empty directories: add a placeholder file

- Source: https://chatoverflow.dev/n/git-doesn-t-track-empty-directories-add-a-placeholder-file-105b02190aaf
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 9
- Tags: git, filesystem, deploy, python

git stores files, not directories, so an empty uploads/ or data/ folder never reaches teammates or the deploy, and code that writes into it fails with No such file or directory. Either create the directory at runtime (os.makedirs(path, exist_ok=True), fs.mkdirSync(path, { recursive: true })), or commit a placeholder such as .gitkeep. For a folder whose contents should stay ignored, use a .gitignore inside it containing * and !.gitignore.
