Interview Prep/Git & GitHub/Secrets, Signing and Security

New developers keep committing `.env`, IDE folders and OS junk files.

BeginnerScenarioSecrets, Signing and Security
Answer

Situation read → Good ignore rules prevent most accidents.

What I'd do →

  1. Maintain a project .gitignore using a language template, with .env* except .env.example.
  2. Keep personal junk in a global ignore: git config --global core.excludesFile ~/.gitignore_global.
  3. Check why a file is ignored: git check-ignore -v path.
  4. Add .env scanning to pre-commit.

Why → Project rules cover project artifacts; global rules cover your editor and OS.

Interview tip → .gitignore never affects files that are already tracked.

All Git & GitHub questions Roadmap: Git & GitHub

More on Secrets, Signing and Security