Have you faced issue where you add a file or folder to .gitignore expecting that git will ignore it while adding to commit. But it is not ignored and more you try, more you fail. It is because prior to adding it to .gitignore, that file or folder is already been tracked. Ignoring the files that is already tracked will not work because it is stored in cache of your local git repository. So, It needs to be deleted from cache first and then stage the changes.
Follow these steps to untrack the gitignore files/folders:
To stop tracking the file and not delete from the local use
git rm --cached <filename>
To untrack every files and directory in your .gitignore file
git rm -r --cached .
This will remove changes from staging.
Now add untracked files
git add .
Then commit your changes
git commit -m ".gitignore fixed"
There you go. You fixed the issue and files/folders are being ignored again.