--author arg on commit only works if there is an email configured already

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

 



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@xxxxxxxxxxx>"'
Initialized empty Git repository in /tmp/tmp.TiNqOZsw9C/.git/

*** 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 '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@xxxxxxxxxx"; git commit -m message --author "A U Thor
<author@xxxxxxxxxxx>"'
Initialized empty Git repository in /tmp/tmp.1drhE2Rgmh/.git/
[master (root-commit) b3dad37] message
 Author: A U Thor <author@xxxxxxxxxxx>
 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




[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