我正在尝试以其他用户的身份提交一些更改,但我没有有效的电子邮件地址,以下命令对我无效:
git commit --author="john doe" -m "some fix"
fatal: No existing author found with 'john doe'
当我尝试仅使用电子邮件地址提交时,也会遇到同样的问题
git commit --author="john@doe.com" -m "some fix"
fatal: No existing author found with 'john@doe.com'
在提交命令的GIT手册页上,它说我可以使用
standard A U Thor <author@example.com> format
用于--author选项。
这种格式在哪里定义?A和U代表什么?如何为仅有用户名或仅有电子邮件的不同用户提交?
发布于 2012-07-20 20:48:38
正如在this SO answer中所暗示的,最低要求的作者格式是
Name <email>
在您的例子中,这意味着您想要编写
git commit --author="Name <email>" -m "whatever"
根据Willem D‘’Haeseleer的评论,如果你没有电子邮件地址,你可以使用<>
git commit --author="Name <>" -m "whatever"
正如您在链接到的git commit
man page上所写的,如果您提供的值小于该值,它将被用作搜索令牌,用于搜索以前的提交,查找该作者提交的其他提交。
发布于 2012-07-20 20:45:57
具体格式为:
git commit --author="John Doe <john@doe.com>" -m "Impersonation is evil."
发布于 2020-03-28 18:46:52
--author
选项不会做正确的事情,因为它不会在git个性之间泄露信息:它不会绕过读取调用的用户的配置:
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
这样做:
git -c user.name='A U Thor' -c user.email=author@example.com commit
为了分离工作和私人git的个性,Git2.13支持directory specific configuration:你不再需要包装Git并自己破解它来获得它。
https://stackoverflow.com/questions/11579311
复制相似问题