Search code examples
gitmsysgit

git - Change all global settings


I have two repos that I want to have different info associated with it.

For example one repo is named site and I want

user.name = admin
user.email =  admin@mysite.com

and for the all other repos I want

user.name = qwertymk
user.email = qwertymk@blah.com

Is there any way to switch profiles or something similar in git?

I'm on windows so I'm using msysgit. (Feel free to give a linux/mac only solution for others though)

EDIT:

I realize now that I could write a batch script to swap c:\users\<me>\.gitconfig but that seems more like a hack.


Solution

  • Git has global settings and per-repository settings.

    Use:

    $ git config --global user.name "qwertymk"
    $ git config --global user.email "qwertymk@blah.com"
    

    Then cd into the 'site' repository and use:

    $ git config user.name "admin"
    $ git config user.email "admin@mysite.com"