logoalt Hacker News

PunchyHamstertoday at 1:40 PM1 replyview on HN

you can have per repo and per directory git config via git conditional includes

    [includeIf "hasconfig:remote.*.url:https://*.github.com/**"]
    path = /home/xani/src/gh/.gitconfig

Replies

silverwindtoday at 3:40 PM

Quite nice. I had to split into two statements to make it work for both https and ssh because of a bug in git:

    [includeIf "hasconfig:remote.*.url:[email protected]:*/**"]
      path = ~/.gitconfig.work
    [includeIf "hasconfig:remote.*.url:https://git.work/**"]
      path = ~/.gitconfig.work