Files that have already been added to version control are not ignored, even if they are under .gitignore
To start ignoring these files, you must first remove them from version control. They can be removed using the git rm --cached <file> command. The --cached option removes files from version control by storing them on disk. Now <file> should stop appearing in the list of updated files.
source share