Organizing multiple Git identities
https://garrit.xyz/posts/2023-10-13-organizing-multiple-git-identities
global config file, ~/.gitconfig
1[user]
2 name = Garrit Franke
3 email = garrit@slashdev.space
4[includeIf "gitdir:~/work/"]
5 path = ~/.gitconfig-work
6[includeIf "gitdir:~/work/client2/"]
7 path = ~/.gitconfig-client2
8[includeIf "gitdir:~/sources/"]
9 path = ~/.gitconfig-personal
If the repository is located inside the ~/work directory, a file named ~/.gitconfig-work is included. This is just another gitconfig file. This is what that looks like in my case:
1[user]
2 name = Garrit Franke
3 signingkey = 12345678
4 email = garrit@work.de
5[commit]
6 gpgsign = true