I'm trying to commit the right files in git, but having problems configuring my gitignore properly. I followed the instructions here to create the gitignore file (django project):
# File types #
##############
*.pyc
*.swo
*.swp
*.swn
# Directories #
###############
logs/
# Specific files #
##################
projectname/settings.py
# OS generated files #
######################
.DS_Store
ehthumbs.db
Icon
Thumbs.db
*~
The problem is that settings.py is getting included in the commit:
Admin$ git add .
Admin$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: projectname/settings.py
How can I ignore settings in my gitignore?
It looks like you already have settings.py
under version control by git. In this case git will continue to track the file - no matter what you write in .gitignore
.
You have to explicitly tell git to forget about settings.py
:
.gitignore
(As you did)git rm --cached projectname/settings.py
git commit -m "remove settings.py"
Afterwards git will ignore the file. But be aware that versions which are already commited will stay in your repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With