I use two different git emails, one for work and one for public projects. Initially I thought that I could create a separate .gitconfig with a different email in a folder where all my public repos are in, and that git would respect that, but alas it seems that doesn't work. What's the best way to easily setup something similar? I want to avoid having to specifically change the email in each public repo.
With conditional includes in Git 2.13, it is now possible to have multiple user/email coexist on one machine with little work. user. gitconfig has my personal name and email.
Subdirectory URL In a URL, the subdirectory comes after the root directory or domain name. For example, HubSpot's root domain is hubspot.com. So a subdirectory URL might be hubspot.com/pricing. Or it might be something more complicated like hubspot.com/pricing/sales.
The best way to do this since git 2.13 is to use Conditional includes.
An example (copied from an answer here):
Global config ~/.gitconfig
[user] name = John Doe email = [email protected] [includeIf "gitdir:~/work/"] path = ~/work/.gitconfig
Work specific config ~/work/.gitconfig
[user] email = [email protected]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With