5 ms·
I manage this with conditional includes in ~/.gitconfig: [includeIf "gitdir:~/work/client1/"] path = ~/work/client1/.gitconfig [includeIf "gitdir:~/work
by darkr 3y ago
I manage this with conditional includes in ~/.gitconfig:
[includeIf "gitdir:~/work/client1/"]
path = ~/work/client1/.gitconfig
[includeIf "gitdir:~/work/client2/"]
path = ~/work/client2/.gitconfig
- perdjesk 3y agoincludeIf directive supports as well conditions based on configured remote URL. [1] [includeIf "hasconfig:remote.*.url:https://client1domain.com/**"] path = ~/work/client1/.gitconfig [includeIf "hasconfig:remote.*.url:https://client2domain.com/**"] path = ~/work/client2/.gitconfig Check comment [2] for a complete example with pinning SSH key and signing key using git-config. [1] https://git-scm.com/docs/git-config#Documentation/git-config.txt-codehasconfigremoteurlcode https://git-scm.com/docs/git-config#Documentation/git-config... [2] https://news.ycombinator.com/item?id=36800853 https://news.ycombinator.com/item?id=36800853
- mechanicker 3y agoThis is the approach that finally worked for me and have been using this for past 4 years. I create a top level directory for collection of related repositories. It lets me configure git for different collection of repositories.