git multiprofile settings

multithread roles

Posted by Yuan on September 21, 2022

Time management

Default git config file

Git profile file is at ~/.gitconfig , which has a content like this:

[credential]
    helper = cache
[user]
	name = Yuan Shang
	email = shangyuan5000@gmail.com

Multiple User Profile Setting

When you have multiple roles collaborating with different entities, you may consider create multiple git profile.

[credential]
    helper = cache

# Default name and email
[user]
	name = Yuan Shang
	email = shangyuan5000@gmail.com
# Other Profiles
[includeIf "gitdir:~/Dropbox/Personal/project1/"]
    path = ~/Dropbox/Personal/project1/git-project1.conf
[includeIf "gitdir:~/Dropbox/ABClab/project2/"]
    path = ~/Dropbox/ABClab/project2/git-project2.conf

In ~/Dropbox/Personal/project1/git-project1.conf, I have:

[user]
    name = yshang
    email = yshang@xxx.com