--author arg on commit only works if there is an email configured already
From: Alvaro Aleman <hidden>
Date: 2020-08-21 17:20:36
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