This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

Author Email

Git commits include name and email address of the author of the patch as well as the person committing the patch. Unless you set up your git client with your email address, your commits will have useless email addresses like "username@localhost.localdomain".

The exact error message you get if you try to push commits without useful email addresses to GNOME repositories is:

The commits you are trying to push contain the author email
address '$email'. Please configure your
username and email address. See:

  http://live.gnome.org/Git/Help/AuthorEmail

For instructions about how to do this and how to fix your
existing commits.

Configuring Name/email

To ensure that the history has proper emails, all people making commits should run

git config --global user.name "Your Name Comes Here"
git config --global user.email you@yourdomain.example.com

on each machine they use git on.

By default git uses your configured user name and email address both as commit and author information. If you are committing a patch written by someone else, you can correctly attribute authorship by using the --author argument of "git commit":

git commit --author 'Author Name <author@name.com>'

Fixing existing commits

If you have existing (unpushed) commits, which you need to fix, you have several options.

In the case of just needing to fix the last commit

git commit --amend --author 'John Doe <user@domain.tld>'

If there are several commits which you need to fix, options include: use "git rebase --interactive", mark the commits for editing, and amend each one. Or use "git format-patch", edit the patches, and use "git am".


2024-10-23 11:09