fatal: --author 'First Last example@example.com' 不是 'Name <email>' 并且不匹配任何现有作者

Jac*_*ern 0 git author git-amend git-commit

我在尝试修改提交以更改作者时遇到了此错误。

git commit --amend --author="First Last example@example.com"
Run Code Online (Sandbox Code Playgroud)
fatal: --author 'First Last example@example.com' is not 'Name <email>' and matches no existing author
Run Code Online (Sandbox Code Playgroud)

它与本文中描述的问题类似,但错误消息不同,因此很难找到解决方案。

我该如何解决这个问题?

Jac*_*ern 7

就我而言,问题不在于在我的电子邮件地址周围加上尖括号。将命令更改为

git commit --amend --author="First Last <example@example.com>"
Run Code Online (Sandbox Code Playgroud)

解决了错误。