Straight from Atlassian: .gitignore
If you want to ignore a file that you've committed in the past, you'll need to delete the file from your repository and then add a .gitignore rule for it.
Using the --cached option with git rm means that the file will be deleted from your repository, but it will remain in your working directory as an ignored file.
You should still have the file in your working directory, but it will not be able to pushed to your remote reporepository, unless you force it.