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
  • 1,005
  • 2
  • 18
  • 37

1 Answers1

5

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
  • 2,203
  • 3
  • 19
  • 34