Re: Bug: Commit fails when no global email address is set even though --author is used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 09, 2024 at 07:43:01AM +0000, Marcus Tillmanns wrote:

> Uff, that’s a mean trap. Especially since there is no “--committer” option
> as far as I can see. Also the difference between the two error messages is
> just one (the first) word.
> 
> Maybe that could be made more obvious, especially if the user specifies
> “--author” already.

There's a way to specify the author and e-mail on the command-line during a
single invocation:

  git -c user.name=marcus -c user.email=user@xxxxxxxxxxx commit ...

This "-c" command-line option is explained in the "root" Git manual page
(run `git help git` for instance).

The reasoning behind having different author and committer is that Git has
been created to handle the development of Linux where most of the code flowed
(and still does, I presume) in in the form of patches sent to a set of mailing
lists, so the person creating a Git commit out of such a patch in most cases
not the person who has authored the change introduced by the patch (the
author).

Also note that you do not have to set the name and e-mail globally: Git has
three levels of configuration, one of which is "local" meaning it's stored in
the repository's metadata. So you can basically run

  git config --local --add user.name marcus

to have this setting apply only to the repository which you "are in"
currently. This value will override any "global" (per-user) settings and any
"system" settings.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux