Reputation: 10838
I have a personal and Work Github Accounts.
By default, git user.email is set to my personal email address. (git config user.email
)
Is there a way if I clone repos from Work github account - it will use work email address automatically? Or what is right approach?
Upvotes: 0
Views: 56
Reputation: 665
I suggest you configure your git with git config user.name
& git config user.email
whenever you need it. Otherwise, if you can work with your two accounts on the same project, you can add your second account as a contributor.
Upvotes: 0
Reputation: 5214
There are several levels of ranges for git config
,
--global
, writes to ~/.gitconfig
--system
, writes to ${prefix}/etc/gitconfig
--local
, default, writes to project .git/config
--worktree
, writes to project .git/config.wroktree
, similar to --local
You can use the project wide --local
config files to override the --global
value, that is, when you setup a project with work account, immediately git config
to add a project wide user.name
and user.email
.
Upvotes: 1