Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5049

Git includeIf for personal and work profiles doesn't work

$
0
0

I've been googling about this, trying different methods from different sources... but it doesn't work.

I want to push commits with my personal profile (defined with "git config --global user.email ...") unless I'm on my work folder.

The content of my .gitconfig is located at C:/Users/my-user/

[user]    name = Personal    email = personal@personal.com[includeIf "gitdir: F:/Work/CompanyName/"]    path = F:/Work/CompanyName/.gitconfig-work

Content of my .gitconfig-work is located at F:/Work/CompanyName/

[user]    name = Work    email = work@work.com

When I go to a cloned repository from work located at:

F:/Work/CompanyName/Project

I use:

git config --show-origin --get user.email

And it shows:

file:C:/Users/<my-user>/.gitconfig

Instead of the route I defined to work.

Thanks for your help.

✨ For the future googlers

I created a gist explaining the steps.


Viewing all articles
Browse latest Browse all 5049

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>