How to Keep Work and Personal Configs Separate on One Machine
Your work git email is showing up in personal commits. Your personal SSH key is authenticating against work repos. ConfigSync profiles fix this permanently.
The Problem: Identity Leaks
If you use one machine for both work and personal projects, you have almost certainly committed to a personal repo with your work email. Or pushed to a work repo using your personal SSH key. These identity leaks are more than embarrassing — they can violate corporate security policies and expose your personal email to coworkers.
The root cause is simple: tools like git read from a single global config file. When you set user.email in ~/.gitconfig, that email applies everywhere. Conditional includes help, but they are fragile and require manual setup on every machine.
ConfigSync Profiles: Isolated Contexts
A ConfigSync profile is a named context that carries its own variables, environment overrides, and path associations. When a profile is active, its settings take precedence over global defaults. Create one for each context:
The --path flag is the key. When you cd into ~/work or any subdirectory, ConfigSync automatically activates the work profile. No manual switching required.
Profile Auto-Switching
ConfigSync resolves the active profile using a priority chain: the --profile flag wins first, then the CONFIGSYNC_PROFILE environment variable, then a .configsync-profile file (walking up parent directories), then the explicitly set active profile, and finally path-based matching.
For most developers, path-based matching handles everything. Put work repos under ~/work and personal repos under ~/personal. ConfigSync detects your current directory and activates the right profile automatically.
Different Git Emails via Templates
Set profile-specific variables for each context:
Then use a template in your .gitconfig:
When ConfigSync renders this template, it substitutes the correct email based on which profile is active. The conditional block ensures work-specific URL rewrites only appear when the work profile is in use.
Separate .env Overrides Per Profile
Beyond git configuration, profiles can carry entirely different environment variable overrides. This is critical when your work and personal projects use different API keys, database URLs, or service endpoints:
When you pull your configuration, the active profile determines which overrides apply. Work secrets stay in work projects. Personal secrets stay in personal projects. No cross-contamination.
Complete Setup: Work + Personal in 5 Minutes
Here is the full sequence to set up isolated work and personal configurations from scratch:
configsync profile show. It displays the active profile name, its variables, and how it was resolved.No More Identity Leaks
With ConfigSync profiles, work and personal configurations are fully isolated. Your git email switches automatically when you move between directories. Your SSH keys, API tokens, and environment variables all follow the same boundaries. Set it up once, push it to the cloud, and every machine you use gets the same clean separation.
Ready to try ConfigSync?
Sync your entire dev environment across machines in minutes. Free forever for up to 3 devices.