4 ms·
Nice. For years I've been using [direnv](https://direnv.net/ https://direnv.net/) for this, setting environment variables which git picks up. This looks like a
by bashtoni 3y ago
Nice.
For years I've been using [direnv](https://direnv.net/ https://direnv.net/) for this, setting environment variables which git picks up. This looks like a more feature complete equivalent, although to be honest I only really need switching of committer email and the SSH key used.
- koolba 3y agoYou don’t need for config for the SSH piece as it defers to SSH’s own config for it.
- halostatue 3y agoIf you’re using SSH for commit signing, you do need that in your git configuration.
- lathiat 3y agoFor the SSH part you can use ~/.ssh/config and it also has conditional stanzas like "Host foo.com" or "Host *.foo.com". Can set username, SSH Key, SSH Agent Socket (I use multiple SSH agents), etc.
- airtonix 3y agomeh. it's much easier to have a conditional git config in ~/.gitconfig that modifies the git ssh command to explicitly use a different ssh key.