I have a simple directory structure:
gitroot/
└── docker/
└── critical_dependencies/
I would like to just ignore the entire contents of the critical_dependencies/
directory. My .gitignore
file has the following entry:
docker/critical_dependencies/*
It doesn't seem to be ignoring any of the folders that are in that directory. What is the proper way to ask the .gitignore
file to ignore everything from a sub-directory?
First, make sure .gitignore file is in the working directory. It doesn't work if you put it in the .git (repository) directory.
cd
to the directory where the .gitignore file is. Or your usual root directory of the project. Check the path of your critical dependencies folder from here.
Then do a cat .gitignore
and add your exact path to the file like so:
docker/critical_dependencies/
It should work.
Git does not display empty directories - so if you need a workaround, look at the second answer here.
A similar issue is found here.
Hope this helps.