Docker and CI/CD · Junior · Question 63 of 75
Should the .env file with local secrets be committed to Git?
- 1Yes, but only on a separate branch that nobody merges
- 2Yes, so that CI can read the secrets from the repository
- ✓Correct answer: No, add it to
.gitignoreand commit an example file instead
Explanation
Secrets in Git spread to every clone and stay in history. A .env.example with placeholder values documents which variables are needed.