Git: name and email address configuration Git: name and email address configuration git git

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 you@example.com

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 79eeaa9f22321580a0e5bee6e237331691cd3b68Author: Sandro Munda <foo@bar.com>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 "some@email.com"git config --global user.name "ha"

So next time those settings will be used.


If you want to prevent git from guessing automatic values you can set

git config --global user.useConfigOnly true

See https://git-scm.com/docs/git-config#Documentation/git-config.txt-useruseConfigOnly