I am trying hide this file .netlify/state.json by adding it to my git but it still shows in my github repo. I just want to hide the state.json file somehow.
My .gitignore file is in my root directory. The .netlify folder is in my root directory.
I have already tried adding several variations of the directory to the .gitignore file.
.netlify/state.json
state.json
.netlify
../.netlify
.netlify/state.json
but it still none of them worked.
Here is the link to my github repo:
https://github.com/able-leopard/a-day-in-the-life-on-mars
Thank you very much in advance!
This is probably caused by a previous commit, if you already have a commit containing that file you will only be ignoring new changes to that file, so you have two options here: delete the file completely or remove it from your source control.
If you want to completely delete the file you could run git rm .netlify/state.json
If you only want to prevent git from tracking that file but not delete it you'll need to run git rm --cached .netlify/state.json
Just remember to add the correct path to that file in the .gitignore
file to stop tracking it.