How to add an empty directory to a git repository

1. Create .gitignore file inside an empty folder.

2. Insert the following code inside .gitignore file.

# Ignore everything in this directory
*
# Except this file
!.gitignore

Optional: If you’re using Netbeans and by default all system core files are being ignored to prevent uploading to repo for security purposes. To include them in the repo you need to Unignore manually. How to? Solutions: Assuming you have followed the instructions above.

1. Right click the folder you want to include in repo

2. Go to >> Git >> “Unignore”

3. Finish. Now you can have them a copy in repo.

Leave a Reply

Your email address will not be published. Required fields are marked *