how to configure ~/.gitconfig file instead of individual repo's .git/config file?

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

  • GIT cannot revert to prior commit - remote won't accept push
  • Branch from *part* of main code, how to keep it up to date?
  • cvs update equivalent in git no remote repository
  • Can't do initial push to Heroku - what's wrong?
  • Git alias with two commands (stash pop + merge) executes only the first command. Why? How to execute also the merge?
  • NoNodeAvailableException elasticsearch in one IntelliJ project but not in other with same programmatic and elasticsearch.yml configuration and code
  • Clarification on using VCS such as Git
  • Some files in my git repo do not have history. What is wrong?
  • Git pull contents of a folder from a repository
  • Does git's -X “theirs” not handle new/deleted file conflicts?
  • Get the commits made by specific authors (more than one)
  • Does Repository.walk traverse all commits
  • One Solution collect form web for “how to configure ~/.gitconfig file instead of individual repo's .git/config file?”

    The easiest way would be:

    • to have userA, userB and userC local account
    • to clone each of the GitHub repo intheir respective local account
    • to have global setting (~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.

    Git Baby is a git and github fan, let's start git clone.