If you Add a .gitignore file After the First Commit all the files already Tracked before your insertion inside the .gitignore will continue to be Tracked also after.
The Solution after you add the .gitignore is to Remove All the Files from the Cached Index with:
git rm -r --cached .
To Add again all your Files to Index:
git add .
To Reset your HEAD with:
git reset HEAD
Once this Procedure Accomplished you Files inserted in the .gitignore do Not will be Tracked Again :)