How can I add an empty directory (that contains no files) to a Git repository?
There's no way to get Git to track directories, so the only solution is to add a placeholder file within the directory that you want Git to track.
The file can be named and contain anything you want, but most people use an empty file named .gitkeep
(although some people prefer the VCS-agnostic .keep
).
The prefixed .
marks it as a hidden file.
Another idea would be to add a README
file explaining what the directory will be used for.