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 9, 2024, at 08:43, Marcus Tillmanns wrote:
> Uff, that’s a mean trap. Especially since there is no “—committer”
> option as far as I can see.

Your report would have been more clear if you included the error:

```
$ git commit -m "Test" --author "My Name <my@xxxxxxxxx>"
Committer identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "you@xxxxxxxxxxx"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got '<machine>')
```

I guess there is no `--committer` since there are use-cases for
attributing the commit to someone else (like you just received a
patch or diff from someone) but there isn’t really a common use-case for
attributing the committer to someone else—the point of the “committer”
is to identify who did the commit itself.

And the error tells you about something that you would want to do in any
case. Because passing in the committer with

```
GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL
```

every time is a lot of work.

I guess the most common workflow is to configure your user globally. But
it’s often the case that you might have a work identity (like the
email). What I do is to try to remember to configure it locally in those
repositories as well. But in the most recent case I forgot about it and
had to rewrite the commits. :) So an alternative is to not set any
global user. And then you will get this complaint every time you start
work in a new repository:

```
Committer identity unknown

*** Please tell me who you are.
```

And then you can copy–paste one of your identities into the local
config. And be certain that you won’t make any commits with the wrong
identity.

That’s more work but also safer.

So I guess that “Please tell me who you are” might be a part of some
peoples’ usual repository setup workflow.

-- 
Kristoffer Haugsbakk





[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