What is `.gitignore` and why doesn't it ignore a file already tracked?

IntermediateConceptGit
Answer

.gitignore only affects untracked files. To stop tracking a file that's already committed, remove it from the index:

git rm --cached secrets.env
All Real-World Interview questions Roadmap: Interview readiness

More on Git