So I have setup a git config to have a work folder and a personal folder:
Is my use case even possible? I don't have found a tutorial with another drive as the C. Maybe git want the same drive as the one with the exe? Would be nice if someone has getting something like this working.
Here it is my .git config (I've tested to inverse the order of the two and that changed nothing)
[user]
email = default@gmail.com
name = Default
[includeIf "gitdir/i:D:/Work/**"]
path = ~/.gitconfig-work
[includeIf "gitdir/i:C:/Personal/**"]
path = ~/.gitconfig-personal
Here is my .gitconfig-work
[user]
email = work@email.com
name = Work
Here is my .gitconfig-personal
[user]
email = personal@email.com
name = Personal
I've tried calling .gitconfig-work on a path on the C drive and it work so the problem should not be the .gitconfig-work. To be precise I've changed to something like this and it work (I got the work@email.com) :
[includeIf "gitdir/i:C:/Personal/**"]
path = ~/.gitconfig-work
So here it is the result of my Personal config (This one works : it use my personal@email.com)
PS C:\Personal> mkdir test
Directory: C:\Personal
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 10/2/2023 12:17 AM test
PS C:\Personal> cd .\test\
PS C:\Personal\test> git init
Initialized empty Git repository in C:/Personal/test/.git/
PS C:\Personal\test> git config --show-origin --get user.email
file:C:/Users/Sacha/.gitconfig-personal personal@email.com
PS C:\Personal\test>
And this one is the result for my Work config and it didn't (it use default@email.com)
PS D:\Work> mkdir test
Directory: D:\Work
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 10/2/2023 12:16 AM test
PS D:\Work> cd .\test\
PS D:\Work\test> git init
Initialized empty Git repository in D:/Work/test/.git/
PS D:\Work\test> git config --show-origin --get user.email
file:C:/Users/Sacha/.gitconfig default@gmail.com
PS D:\Work\test>
By the way, my D drive is a partition on another(physically) drive in FAT32, I need to have my work on this drive since my D drive is a shared partition with a Pop OS 22.04 I need my two Os to access this folder.
Git : git version 2.40.1.windows.1
Windows Version: 22H2
I've tested when assigning a true path to my D drive (so I could use it like C:/Shared) but didn't changed anythings.
Thanks to all people that will help.
I you want more info, here is the github issue I've made : https://github.com/git-for-windows/git/issues/4621
This a quick answer, you need to have sufficent access right in that repo, so by adding this in your .gitconfig, you should be able to get this working :
[safe]
directory = *