0

I am currently working with a git repo that has a settings.py file in it.

The file itself consists of a basic template but when I am using it on my local machine I need to chnage a username and password to match my local database, however, I do not wish to commit this changed settings file back to the repo.

I have added the file to my .gitignore but it is still in my git control tab on vs code. After searching around I believe that is because the file has already been commited to the repo before. I then found that to remove that cached version I could use:

git rm -r --cached .
git add .
git commit -m "clearing cahced files"

This, although keeping my local copy of the settings file and removing it from the git control tab meaning it doesnt want me to commit the changes anymore, also removes it from the repo which I don't want it to do.

Essentially I am wondering if there is a way to stop the changes to this file from wanted to be commited but keeping the 'skeleton' file in the repo?

Liam
  • 139
  • 3
  • 11
  • Does this answer your question? [How do I configure git to ignore some files locally?](https://stackoverflow.com/questions/1753070/how-do-i-configure-git-to-ignore-some-files-locally) – Chris Maes Apr 28 '20 at 12:35
  • 1
    This is normally done through ignoring the file and creating a copy template file that you do track. – eftshift0 Apr 28 '20 at 13:15

0 Answers0