Sometimes in Git, we want to preserve a directory for use within a repository, but keep it empty of files. There are many reasons why you'd want to do this, but perhaps either , or . the folder is used to store files the person cloning the repository needs to create a script creates custom files to put into that folder If you want to create a blank directory, you can do that easily, but it won't be pushed when we use to push it to your remote. As such we need to do something slightly different. git push Create a blank directory in the Git Repository The easiest way to do this is by creating a file within the directory you want to maintain. .gitignore - index.html - myRepository <-- Empty directory - myCss --- style.css --- main.css You may want to push to your git repository. To do that, create a new file in called . In that file, put the following code: myRepository myRepository .gitignore * */ !.gitignore This will , but include the file itself. This means the file will be pushed and we can keep the directory while not keeping any of its contents. ignore all files, folders, and subdirectories .gitignore Next, just push your git repository as you would usually do by running the following commands: git add . git commit -m "Added .gitignore" git push Your directory will now persist in your repository, while the contents of the directory will not. Also Published Here