git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kristoffer Haugsbakk" <code@khaugsbakk.name>
To: "Marcus Tillmanns" <Marcus.Tillmanns@qt.io>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
	"Phillip Wood" <phillip.wood@dunelm.org.uk>
Subject: Re: Bug: Commit fails when no global email address is set even though --author is used
Date: Fri, 09 Feb 2024 09:37:12 +0100	[thread overview]
Message-ID: <3c3db003-1506-47c4-a010-a8b783dff959@app.fastmail.com> (raw)
In-Reply-To: <60512662-9BE1-4DF7-A4E0-FD2E852E8E76@qt.io>

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@email.com>"
Committer identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  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

  parent reply	other threads:[~2024-02-09  8:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-08 15:26 Bug: Commit fails when no global email address is set even though --author is used Marcus Tillmanns
2024-02-08 15:50 ` Phillip Wood
2024-02-09  7:43   ` Marcus Tillmanns
2024-02-09  8:21     ` Konstantin Khomoutov
2024-02-09  8:37     ` Kristoffer Haugsbakk [this message]
2024-02-09  8:46       ` Marcus Tillmanns
2024-02-09 11:02         ` Kristoffer Haugsbakk
2024-02-09 17:30           ` Junio C Hamano
2024-02-09 17:38             ` Kristoffer Haugsbakk
2024-02-09 19:56               ` Junio C Hamano
2024-02-10  9:42                 ` Marcus Tillmanns
2024-02-10 17:21                   ` Junio C Hamano
2024-02-11 18:16                 ` Kristoffer Haugsbakk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3c3db003-1506-47c4-a010-a8b783dff959@app.fastmail.com \
    --to=code@khaugsbakk.name \
    --cc=Marcus.Tillmanns@qt.io \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).