How do you handle secrets/env files properly in a team repo? #189232
Select Topic AreaQuestion BodyI know the basics: never commit .env files, add them to .gitignore. But I'm curious how real teams handle this beyond that. Do you use a secrets manager (Vault, AWS Secrets Manager, Azure Key Vault)? I'm currently working on an ASP.NET project and want to build good habits early. What's worked for your team? |
Replies: 4 comments 3 replies
|
Good question. Most teams handle this in a few simple layers.
In practice the common setup is: .env ignored .env.example committed secrets stored outside the repo CI/CD injecting them during deployment That pattern scales pretty well from small projects to larger teams. |
|
In most professional teams, handling secrets goes beyond just ignoring .env files. Many teams use a secrets manager, such as Vault, AWS Secrets Manager, or Azure Key Vault, to securely store and manage credentials. Sharing secrets with new team members is usually done through controlled access in these tools rather than sending files over chat or email. Using a .env.example file as a template is common practice, as it documents required variables without exposing sensitive data. Teams also often implement workflows for rotating secrets when someone leaves, ensuring old credentials are revoked and replaced. Building these habits early, especially in an ASP.NET project, helps maintain security and scalability as the team grows. |
|
Hi, You’re already on the right track by never committing 1️⃣ Use a secrets managerMost teams rely on centralized secrets storage instead of local
These allow secure access control, logging, and automatic rotation. 2️⃣ Sharing secrets with team members
3️⃣ Use
|
|
I ended up building an OSS tool around pretty much this exact problem. The specific case I'm trying to solve is: a code change introduces a new local env requirement, someone pulls it, and then has to figure out which value they're missing and ask around for it. local.env connects that requirement to GitHub and lets the team resolve/sync the local value through the CLI. It's intentionally only for local development, not production secrets. If you're still dealing with this problem, I'd genuinely love to know if this approach would fit your workflow, I'm looking for a handful of teams to break the first public version. |
Hi,
You’re already on the right track by never committing
.envfiles and using.gitignore. In professional teams, managing secrets goes beyond that. Here’s a common workflow that works well:1️⃣ Use a secrets manager
Most teams rely on centralized secrets storage instead of local
.envfiles for sensitive data. Popular options include:These allow secure access control, logging, and automatic rotation.
2️⃣ Sharing secrets with team members