Git · Junior · Question 9 of 75

You added .env to .gitignore, but Git still tracks changes to it. Why?

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.

Further reading

Problem with a question

Git · Junior · question 9

Test yourself

Take the Git · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz