Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is git still tracking files with extensions already added to .gitignore file

Tags:

git

I am having problems with data.sqlite and members/model.pyc This is how my .gitignore file looks. If the above-mentioned files show as modified it means git is still tracking them right? These files were not tracked before so I am not sure why it is not ignoring those files....

*.py[cod]
*.sqlite
# C extensions
*.so
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
__pycache__
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
nosetests.xml
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
*.log
*.pot
*.pyc
local_settings.py
like image 390
BluePython Avatar asked Dec 25 '22 20:12

BluePython


1 Answers

If the file already exists, you need to force-delete it:

git rm --cached foo.pyc

for every file already tracked. Commit, push, and profit. The file will remain ignored but in the working directory.

like image 177
nanofarad Avatar answered Mar 16 '23 01:03

nanofarad