Search code examples
gitgitignore

Git not excluding even untracked files


I am running into a problem with git. I have initialized a new git repo and wrote ".gitignore" first but git is not excluding those files and folders. I have tried "git rm -r --cached" and then added only .gitignore file but it all went in vain. [screenshot of IDE]

Tried unstaging the files but as you can see in the screenshot, git status is still showing the .venv and pycache folder that should be excluded in the untracked section.


Solution

  • As suggested by @j6t , UTF-16 encoding for .gitignore will not work. So, save it as UTF-8 and the problem will be gone. If you run into the same problem then before following any other procedures make sure correct encoding has been selected while saving the file.