Adding an Empty Directory to Git

Posted by Grego on April 4, 2017

If you’ve noticed, git does not allow you to add empty directories and commit them.

There is a simple work around. Create a .gitignore file inside the empty directory:

*
!.gitignore

The first line says to ignore every file in this directory, recursively. The second line adds an exception that the .gitignore file should not be ignored.

Git with it!