8

System settings: MacOS Catalina 10.15.6

> git --version
git version 2.24.3 (Apple Git-128)

file: ~/.gitconfig :

[user]
    name = nickname
    email = nickname@gmail.com
[includeIf "gitdir:~/Business"]
    path = ~/.gitconfig-work

file: ~/.gitconfig-work :

[user]
    name = First Last
    email = fl@work.com

Output when trying to check the configuration on terminal:

(base) MBP-Name:~ myname$ cd ~/Business/
(base) MBP-Name:Business myname$ git config --get user.name
nickname

I have tried both relative ~ and absolute / paths either for gitdir and path in the config file. On each change I am restarting the bash. Also, I have read several other stackoverflow questions with no success. Some of them where suggesting adding the i option for case insensitivity but it didn't fix the problem.

Any ideas ?

entropyfever
  • 125
  • 1
  • 6
  • 15
    Is `~/Business/` a repository (working tree)? If not hint: `includeIf` works only in **repositories** under `~/Business/` but not in a non-repo directory. – phd Nov 15 '20 at 10:33
  • 4
    @phd You were totally right. I had to change ``` "gitdir:~/Business"``` to ``` "gitdir:~/Business/"``` and hit the command inside a repo folder```. Thank you <3 – entropyfever Nov 15 '20 at 10:36

0 Answers0