Make sure all changes are commited including the .gitignore
To clear the repo, use: git rm -r --cached .
rmis the remove command-rwill allow recursive removal--cachedwill remove files from the index. (Your file will still be there).indicates that all files will be untracked.- Untracking a specific file use:
git rm --cached foo.txt
- Untracking a specific file use:
The
rmcommand can be unforgiving. If you wish to try what it does beforehand, add the-nor--dry-runflag to test.
git add .
git commit -m '.gitignore fix'
source: http://www.codeblocq.com/2016/01/Untrack-files-already-added-to-git-repository-based-on-gitignore/