Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git - [includeIf] multiple gitconfigs not working

Tags:

git

I'm trying to get multiple gitconfigs working on my repos use [includeIf]. I have a regular repo at: ~/Development/Business/work/ and a test repo at ~/Development/Business/test/.

The following global gitconfig and specific gitconfigs are as follow:

~.gitconfig

[user]
    name = First Last
    email = [email protected]
    
[includeIf "gitdir:~/Development/Business/test/"]
    path = ~/Development/Business/test/.gitconfig

~/Development/Business/test/.gitconfig

[user]
    name = First Last
    email = [email protected]

My HOME environmental variable is C:\

When I run git config user.email on the path ~/Development/Business/test/repo1 I receive the following output:

git config user.email
[email protected]

However, the expected outcome should be:

git config user.email
[email protected]

When I run git --show-origin user.email the output is

file:C://.gitconfig [email protected]

Shouldn't it be pointing to test/.gitconfig?

like image 460
asking_for_a_friend Avatar asked Mar 06 '20 04:03

asking_for_a_friend


1 Answers

This feature comes from Git 2.14 (Q3 2017), which includes some tests:

In case ~ is not properly replaces by %HOME%, try and use /C/ in your paths to check if this works better (for testing).

like image 118
VonC Avatar answered Nov 15 '22 03:11

VonC