git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: "commit --author=..." does not work if global email and name is not set

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 5, 2019, 08:11 UTC
Message-ID
<CAPc5daVQTouBVqJPccQNdzFP6XYEL7G2UUH-HC4QgYdRWt__Kw@mail.gmail.com>
In-Reply-To
<CAA01Csp7y9=2n9=TNYMMw9LUO_cENz7FBeZjFrUd2FvHFT9NCQ@mail.gmail.com>

On Fri, Apr 5, 2019 at 4:35 PM Piotr Krukowiecki <piotr.krukowiecki@gmail.com> wrote:

Show 7 quoted lines
>
> Hi,
>
> I have a repo downloaded on machines which do automatic tests.
> Sometimes I want to make a quick fix there and push back to origin.
> Reading git-commit docs I had impression that I can use "--author=me"
> and it will work. But it requires setting global user name and email:
You can still do
 git -c user.name=me -c user.email=me@my.addre.ss commit ...

if you do not want to follow the advice message to store the ident permanently.

>   git config --global user.email "you@example.com"
>   git config --global user.name "Your Name"

Technically, what you are missing when you give --author is only the committer ident, so you can probably use

  GIT_COMMITTER_NAME=me GIT_COMMITTER_EMAIL=me@my.addre.ss \
  git commit --author=me ...
even though it is not any shorter ;-).

I think all of the above is quite expected. The fact that --author is used to specify the ident of the author is a good sign that it is different from the committer ident (otherwise the user would be using a configured default ident that is always used as the committer ident, without overriding it with the --author) option.

Previous: Piotr KrukowieckiNext: Jakub Narebski
Message 2 of 10 in “"commit --author=..." does not work if global email and name is not set”
  1. Piotr KrukowieckiApr 5, 2019
  2. Junio C HamanoApr 5, 2019
  3. Jakub NarebskiApr 6, 2019
  4. Junio C HamanoApr 8, 2019
  5. Piotr KrukowieckiApr 8, 2019
  6. Jakub NarebskiApr 8, 2019
  7. Piotr KrukowieckiApr 8, 2019
  8. Junio C HamanoApr 9, 2019
  9. Piotr KrukowieckiApr 9, 2019
  10. Jakub NarebskiApr 9, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.