The series of commands below will remove all of the items from the Git Index (not from the working directory or local repo), and then updates the Git Index, while respecting git ignores. PS. Index = Cache
First:
git rm -r --cached .
git add .
Then:
git commit -am "Remove ignored files"
.gitignore
applies to every clone of this repository (versioned, everyone will have it),
.git/info/exclude
only applies to your local copy of this repository (local, not shared with others),
~/.gitconfig
applies to all the repositories on your computer (local, not shared with others).
actually requires to set a configuration on your computer :
git config --global core.excludesfile '~/.gitignore'