Reputation: 111
How to configure ~/.gitconfig file instead of individual repo's .git/config file?
## use this config if repository belongs to userA@github
[user]
name = userA
email = userA@gmail.com
## use this config if repository belongs to userB@github
[user]
user: userB
email: userB@yahoo.com
## use this config if repository belongs to userC@bitbuck
[user]
user: userC
email: userC@hotmail.com
Upvotes: 1
Views: 347
Reputation: 1329092
The easiest way would be:
userA
, userB
and userC
local account~userA/.gitconfig
, ~userB/.gitconfig
, ~userC/.gitconfig
) in place with the right user names and emails.In that case, there would be no configuration required: any repo clone under ~userA
home directory would benefit from the right user.name
and user.email
.
But if you are trying to that automatically under *one local account, then you need to come up with some script which will create/update the right value in the local config file ~/repo/gitHubCloneRepo/.git/config
.
Upvotes: 1