Use a different user.email and user.name for Git config based upon remote clone URL : <p>I configure my global <code>~/.gitconfig</code> properties <code>user.name</code> and <code>user.email</code> like this:</p>

<p></p>

<pre><code>git config --global user.email "mkobit@example.com" 
git config --global user.name "mkobit"
</code></pre>

<p>This is the default configuration I want for working on personal projects, open source stuff, etc.</p>

<p>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 <code>user.name</code>/<code>user.email</code>:</p>

<pre><code>git clone ssh://git@git.mycorp.com:1234/groupA/projectA.git
cd projectA
git config user.email "mkobit@mycorp.com"
git config user.name "m.kobit"
</code></pre>

<p>One decent option would be to setup an alias for cloning these kinds of repositories:</p>

<pre><code>git config --global alias.clonecorp 'clone \ 
        -c user.name="m.kobit" -c user.email="mkobit@mycorp.com"'
git clonecorp ssh://git@git.mycorp.com:1234/groupA/projectA.git
</code></pre>

<p>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.</p>

<p>Is there a way to configure Git such that repositories from a certain domain (the <code>mycorp.com</code> in this example) will be configured a certain way? </p>
