profile for Gajendra D Ambi on Stack Exchange, a network of free, community-driven Q&A sites

Wednesday, September 26, 2018

git and ignoring files

So if you had thought that creating a .gitignore file in your git repository's root was enough then you are wrong. You will notice that that is what is the official way to ignore file. Here is the problem.

  1. I started working on a project and stored all secrets in
  2. 7 more people in my team joined it and now we decided that we should not commit anymore to dev server. 
  3. Everybody added it to their .gitignore file but no go
What to do?

git rm <filepath>/<filename>
git rm --cached <filepath>/<filename>

Since the file was being tracked earlier it will still be tracked. So remove that from tracking and you are good to go.