Skip to content

Identities

An identity groups a git author, an SSH key, and a set of credential entries. Switching identity switches all of them at once.

identities:
- id: personal
git_user: Your Name
email: you@example.com
ssh_key: ~/.ssh/id_ed25519
default: true
activates:
npm_token: personal
gh_token: personal
- id: work
git_user: Your Name
email: you@company.example
ssh_key: ~/.ssh/work_ed25519
activates:
npm_token: work
gh_token: work
Terminal window
loadout identity list # what is configured, and which is active
loadout identity activate work

Or the shipped s function, which is the same thing with less typing:

Terminal window
s work

Switching does three things: sets your git author for subsequent commits, adds the identity’s SSH key to the agent, and makes each credential entry named in activates the active one.

It does not change shells you already have open. Credential values were exported into those shells when they started; changing which entry is active updates the configuration, not the processes already running.

Re-run the eval in any shell that needs the new values:

Terminal window
eval "$(loadout env)"

Or use the flag that prints them for you:

Terminal window
loadout identity activate work --export

which emits the export lines for the new entries alongside the switch, ready to be evaluated.

It does not rewrite the generated shell file. Identity is runtime state, not something baked into init.zsh, so there is no need to run loadout apply after switching.

Keys are credential names, values are entry names. Both must exist:

activates:
npm_token: work # npm_token must be declared, with an entry called work

An identity may nominate any subset. Credentials not named are left on whatever entry they were on, which is usually what you want for a token that is not account-specific.

Terminal window
loadout env --identity work

Prints the export lines as they would be after switching, without switching. Useful in a script that needs work credentials for one command without disturbing your session.

The git author is applied with git config, scoped globally by default. If you would rather scope per repository, do not use identity switching for it — set user.email in the repository and git will prefer it.

The SSH key is added with ssh-add, which reaches the agent over $SSH_AUTH_SOCK and therefore works from a child process. That is why s could have been a subcommand of the binary rather than a shell function; it stays a function only for consistency with the rest of the catalog.