Hacker News new | past | comments | ask | show | jobs | submit login

I manage this with conditional includes in ~/.gitconfig:

  [includeIf "gitdir:~/work/client1/"]
   path = ~/work/client1/.gitconfig
  [includeIf "gitdir:~/work/client2/"]
   path = ~/work/client2/.gitconfig



includeIf 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...

[2] https://news.ycombinator.com/item?id=36800853


This 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.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: