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

Re: Bug: Commit fails when no global email address is set even though --author is used

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Feb 8, 2024, 15:50 UTC
Message-ID
<51599394-3f75-4b75-a4c0-f13f117e73bc@gmail.com>
In-Reply-To
<F7D40DCD-2331-44D8-B4BF-8E6CD9EE64A6@qt.io>
Hi Marcus
On 08/02/2024 15:26, Marcus Tillmanns wrote:
Show 14 quoted lines
> What did you do before the bug happened? (Steps to reproduce your issue)
> 
> * Set your machines hostname to a name that does not contain "." (e.g. "ihavenodotinmyhostname")
> * Make sure you have no name or email configured in your global git config
> * Create a new repository and "git add" a file
> * Run: git commit -m "Test" --author "My Name <my@email.com>"
> 
> What did you expect to happen? (Expected behavior)
> 
> A commit should be created with author name "My Name", and author email "my@email.com"
> 
> What happened instead? (Actual behavior)
> 
> An error is thrown, complaining about not being able to determine the email address

This is expected as "git commit" needs an identity to use for the committer as well as for the author. To set the committer you can use the GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL environment variables if you don't have the relevant config set and git cannot extract a domain from your hostname.

Best Wishes
Phillip
Previous: Marcus TillmannsNext: Marcus Tillmanns
Message 2 of 13 in “Bug: Commit fails when no global email address is set even though --author is used”
  1. Marcus TillmannsFeb 8, 2024
  2. Phillip WoodFeb 8, 2024
  3. Marcus TillmannsFeb 9, 2024
  4. Konstantin KhomoutovFeb 9, 2024
  5. Kristoffer HaugsbakkFeb 9, 2024
  6. Marcus TillmannsFeb 9, 2024
  7. Kristoffer HaugsbakkFeb 9, 2024
  8. Junio C HamanoFeb 9, 2024
  9. Kristoffer HaugsbakkFeb 9, 2024
  10. Junio C HamanoFeb 9, 2024
  11. Marcus TillmannsFeb 10, 2024
  12. Junio C HamanoFeb 10, 2024
  13. Kristoffer HaugsbakkFeb 11, 2024

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.