I configure my global ~/.gitconfig
properties user.name
and user.email
like this:
git config --global user.email "[email protected]"
git config --global user.name "mkobit"
This is the default configuration I want for working on personal projects, open source stuff, etc.
When I am working on a project from a specific domain, a corporate domain for example, I am configuring it for each repository when I clone it so that it uses a different user.name
/user.email
:
git clone ssh://[email protected]:1234/groupA/projectA.git
cd projectA
git config user.email "[email protected]"
git config user.name "m.kobit"
One decent option would be to setup an alias for cloning these kinds of repositories:
git config --global alias.clonecorp 'clone \
-c user.name="m.kobit" -c user.email="[email protected]"'
git clonecorp ssh://[email protected]:1234/groupA/projectA.git
Both of these can be error prone because they both depend on me being smart and following the right steps. Evidence shows that this is near-guaranteed for me to screw-up sometime.
Is there a way to configure Git such that repositories from a certain domain (the mycorp.com
in this example) will be configured a certain way?