Some times, even if you haven’t added some files to the repository,
git seems to monitor them even after you add them to the
This is a caching issue that can occur and to fix it, you need to clear your cache.
NOTE : Before proceeding with this solution, commit all changes you do not want to lose!
.. then execute the following commands from the root folder of your repository:
The following, will untrack every file that is in your
git rm -r --cached .; git add .; git commit -m "Untracked files issue resolved to fix .gitignore";
git-rm removes files from the index, or from the working tree and the index.
git rm will not remove a file from just your working directory. (There is no option to remove a file only from the working tree and yet keep it in the index; use
/bin/rm if you want to do that.) The files being removed have to be identical to the tip of the branch, and no updates to their contents can be staged in the index, though that default behavior can be overridden with the
-f option. When
--cached is given, the staged content has to match either the tip of the branch or the file on disk, allowing the file to be removed from just the index.
-r allows recursive removal when a leading directory name is given.
--cached unstages and removes paths only from the index. Working tree files, whether modified or not, will be left alone.
To stop tracking a single file file but not delete it from your filesystem use the following:
git rm --cached <file>;
Another issue: file removed from .gitignore filters does not appear to be tracked
When you remove something from
.gitignore file and the file does not appear to be tracked, you can add it manually as follows:
git add -f <file>; git commit -m "Re-Adding ignored file by force";
This post is also available in: Greek
10/10 works like a treat!
Good article and explanation. Thanks for the post.
Thank you so much, Worked right away 🙂
This solved my problem, thanks.
Pingback: Git ignore setup – Software Tech
Thanks, it helps a lot
Pingback: "Git Ignorer ne fonctionne pas sur le référentiel local" Code de réponse de la réponse - Coder les réponses
Pingback: "Git Ignore Yerel Depo Üzerine Çalışmıyor" Kodu Cevaplar - Kod Yanıtları
Pingback: “git ignore not working” Code Answer’s – My Blog
Pingback: “.gitignore not working” Code Answer’s – My Blog