Git: name and email address configuration

Git simply detects you don't have the following section in your config files:

[user]
    name = <your name>
    email = <your mail>
  • <project_path>/.git/config for the project specific config file.
  • ~/.gitconfig the global config file

When you do:

git config --global user.name "Your Name"
git config --global user.email [email protected]

Git writes that information into the configuration file (--global means in the global config file).

To have a the correct Author section in a commit like the following example commit:

commit 79eeaa9f22321580a0e5bee6e237331691cd3b68
Author: Sandro Munda <[email protected]>
Date:   Thu Jun 8 10:40:05 2012 +0200

    My first commit

You need to reset the commit information with the command:

git commit --amend --reset-author


That's simply because you didn't set your global user.name and user.email and so git has to guess them when creating a new repository.

Use this :

git config --global user.email "[email protected]"
git config --global user.name "ha"

So next time those settings will be used.

Tags:

Git