Member-only story

Multiple git config

Nhan Cao
1 min readApr 14, 2020

Global git config at ~/.gitconfig

[user]
name = Nhan Cao
email = nhancv92@gmail.com

Create a config file if it does not exist.

To assume you need all commit in the specific folder tree use another author.

  • Create a new git config file in that specific folder. The example: I place in ‘eric’ folder: /Volumes/Data/Projects/eric/.gitconfig
[user]
name = Eric Cao
email = ericc@gmail.com
  • Then update the global git config file like
[user]
name = Nhan Cao
email = nhancv92@gmail.com
[includeIf "gitdir:/Volumes/Data/Projects/eric/"]
path = /Volumes/Data/Projects/eric/.gitconfig

You can put a lot of config file to global

[user]
name = Nhan Cao
email = nhancv92@gmail.com
[includeIf "gitdir:/Volumes/Data/Projects/eric/"]
path = /Volumes/Data/Projects/eric/.gitconfig
[includeIf "gitdir:/Volumes/Data/Projects/boy/"]
path = /Volumes/Data/Projects/boy/.gitconfig
[includeIf "gitdir:/Volumes/Data/Projects/girl/"]
path = /Volumes/Data/Projects/girl/.gitconfig

For windows

[includeIf "gitdir:D:/Projects/eric/"]
path = D:/Projects/eric/.gitconfig

Nhan Cao

nhancv.com

--

--

No responses yet