Git · Junior · Question 9 of 75
You added .env to .gitignore, but Git still tracks changes to it. Why?
- ✓Correct answer: The file was already committed; ignore rules apply only to untracked files
- 2The
.gitignorefile must be committed before it starts working - 3Ignore rules take effect only after
git push
Explanation
Run git rm --cached .env to stop tracking it while keeping the file on disk, then commit. If it contained secrets, they are still in history, so rotate them.