Skip to main content
Home It's only 1 step 2 your solution!

.gitignore not ignoring files - is it not working?

When setting up new git repositories it may happen to you as well:

You have defined a .gitignore file but git anyway wants to commit files which have been marked as to be ignored.

What is going on there?

The most important thing you need to know is:

.gitignore file should be added to the repository first before any other commits!

Otherwise: it may appear as it is not working!

 

Based on this new revolutionary information you may fix already existing git repos with a fixed .gitignore file by using:

git rm -r --cached . 
git add . 
git commit -m ".gitignore - it does work!"