NEVER commit .env files to Git!
The .gitignore file is configured to automatically exclude:
.env- Main environment file.env.*- Any .env variant files*.env- Any file ending in .env.env.local- Local overrides.env.production- Production config.env.development- Development config.env.test- Test config
To verify your .env file is not tracked:
# Check if .env is ignored
git check-ignore .env
# Verify .env is not in Git
git ls-files | grep .env
# Should return nothing if properly ignoredIf you accidentally committed a .env file:
# Remove from Git (but keep local file)
git rm --cached .env
# Commit the removal
git commit -m "Remove .env file from Git"
# Push the change
git push
# IMPORTANT: If you pushed sensitive data, rotate all API keys and passwords!- β
Always use
.gitignoreto exclude.envfiles - β
Never share
.envfiles in emails or messages - β
Use
.env.exampleas a template (without real values) - β
Rotate credentials if
.envwas ever committed - β Use environment variables in production (not files)
β
.gitignore is configured correctly
β
.env files are excluded from Git
β
No .env files are tracked in the repository
Remember: Your .env file contains sensitive credentials. Keep it secure!