How can I add an empty directory (that contains no files) to a Git repository?
touch .keep
On Linux, this creates an empty file named .keep
. For what it's worth, this name is agnostic to Git. Secondly, as another user has noted, the .git
prefix convention can be reserved for files and directories that Git itself uses for configuration purposes.
Alternatively, as noted in another answer, the directory can contain a descriptive README.md file instead.
Either way this requires that the presence of the file won't cause your application to break.