git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* --author arg on commit only works if there is an email configured already
@ 2020-08-21 16:15 Alvaro Aleman
  2020-08-21 18:28 ` Andreas Schwab
  0 siblings, 1 reply; 10+ messages in thread
From: Alvaro Aleman @ 2020-08-21 16:15 UTC (permalink / raw)
  To: git

Hello everyone,

It seems the `--author` arg on the `git commit` command only works if
an author email is configured already somewhere:

Sample that I would expect to work and that does not work:

```
$ docker run --rm -it golang /bin/bash -c 'cd $(mktemp -d); git init;
touch test; git add test; git commit -m message --author "A U Thor
<author@example.com>"'
Initialized empty Git repository in /tmp/tmp.TiNqOZsw9C/.git/

*** 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 'root@aedfbe0df193.(none)')
```

When configuring any mail first, this works and uses the mail
specified in the `--author` arg:

```
$ docker run --rm -it golang /bin/bash -c 'cd $(mktemp -d); git init;
touch test; git add test; git config --local user.email
"mail@domain.com"; git commit -m message --author "A U Thor
<author@example.com>"'
Initialized empty Git repository in /tmp/tmp.1drhE2Rgmh/.git/
[master (root-commit) b3dad37] message
 Author: A U Thor <author@example.com>
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 test
```

The git version:
$ docker run --rm -it golang  git --version
git version 2.20


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-08-21 22:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-21 16:15 --author arg on commit only works if there is an email configured already Alvaro Aleman
2020-08-21 18:28 ` Andreas Schwab
2020-08-21 18:46   ` Junio C Hamano
2020-08-21 19:55     ` Alvaro Aleman
2020-08-21 20:36       ` [PATCH] ident: say whose identity is missing when giving user.name hint Junio C Hamano
2020-08-21 20:52         ` Eric Sunshine
2020-08-21 21:13           ` Junio C Hamano
2020-08-21 21:31             ` Alvaro Aleman
2020-08-21 21:37               ` Eric Sunshine
2020-08-21 22:35                 ` Junio C Hamano

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).