Switching Work vs Personal Identity
This setup uses two related mechanisms:
- git identity switching via
includeIf(based on working directory) - password-store switching via
PASSWORD_STORE_DIR
Preconditions
- Dotfiles are applied.
- On non-work machines,
~/.password-store-workexists if you usewpass.
Steps
- For git identity switching, use directory placement (
~/work/...vs personal paths). - For password-store switching:
wpass
ppass
Git Identity Switching
On non-work machines, repos under ~/work/ load a secondary git config.
Relevant files:
home/private_readonly_dot_gitconfig.tmpl(primary, installed as~/.gitconfig)home/work/private_dot_gitconfig.tmpl(work override)
In practice: if you clone a repo under ~/work/..., commits and SSH identity selection switch automatically.
Password Store Switching
On non-work machines, fish defines helpers:
wpasssetsPASSWORD_STORE_DIR=~/.password-store-workppassunsetsPASSWORD_STORE_DIR(defaulting back to~/.password-store)
Setup script:
Verification
Git:
git config --get user.email
git config --get core.sshCommand
Password store:
echo "$PASSWORD_STORE_DIR"
pass ls
Rollback / Undo
- Reset password-store selection:
ppass
- Move repo out of
~/work/(or into it) to changeincludeIfmatching. - Re-check effective config:
git config --show-origin --get user.email