🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Git Config, .gitignore and Hooks: all 10 questions

Quiz: Git Config, .gitignore and Hooks · Question 5 of 10

You added .env to .gitignore, but git status still shows changes to it. Why?

You added .env to .gitignore, but git status still shows changes to it. Why?

  1. A..gitignore needs a restart of Git
  2. B.The pattern must be *.env*
  3. C..env was already committed; .gitignore does not affect tracked files
  4. D..env files can never be ignored
Answer & explanation

Correct answer: .env was already committed; .gitignore does not affect tracked files

Run git rm --cached .env and commit to stop tracking it.

Can you get the rest right without peeking?

Take the timed Quiz: Git Config, .gitignore and Hooks quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →