2

My .gitignore has the following:

./config.json

But my config.json is still being committed when I make changes.

Why is this happening?

Mary
  • 825
  • 1
  • 13
  • 29

1 Answers1

4

If you file was added to repository before you added it to gitignore you should explicity remove it from repository

git rm config.json
git commit <message>

After removed from repository this file will be ignore as expected.

If you want to save this file in your file system you can remove with --cached option

git rm --cached config.json
Alexcei Shmakov
  • 1,973
  • 3
  • 18
  • 30