Skip to main content

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-work exists if you use wpass.

Steps

  1. For git identity switching, use directory placement (~/work/... vs personal paths).
  2. For password-store switching:
wpass
ppass

Git Identity Switching

On non-work machines, repos under ~/work/ load a secondary git config.

Relevant files:

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:

  • wpass sets PASSWORD_STORE_DIR=~/.password-store-work
  • ppass unsets PASSWORD_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 change includeIf matching.
  • Re-check effective config:
git config --show-origin --get user.email