Git 提交未使用存储库配置的“user.name”值
Git commits are not using the repository-configured `user.name` value
我有一个存储库,我在其中配置了本地 user.name
和 user.email
。我已经验证了 运行 git config user.name
和 git config user.email
在 git 仓库中给出了正确的输出,我的 .git/config
文件也正确地显示了它们 - 但是我的提交仍然使用我的全局 user.name
(尽管它们确实使用了正确的本地 user.email
)。我是 运行 macOS 10.13.4 和 Git 2.17.1 - 这个问题在命令行 git 和从 IntelliJ 提交时都会发生。可能是什么问题?
如果 git config user.name
打印出正确的名称但 git commit
没有使用该名称,则一定是某些东西覆盖了配置值。
明显的(咳嗽)候选者是 environment variable, as listed in the top level git
command manual page, most of the way to the end. You can do a quick test whether this is the case using the git var
command:
$ git var GIT_AUTHOR_IDENT | sed 's/@/ /'
Chris Torek <chris.torek gmail.com> 1528489689 -0700
对比:
$ GIT_AUTHOR_NAME='A U Thor' GIT_AUTHOR_EMAIL=thor@example.com git var GIT_AUTHOR_IDENT
A U Thor <thor@example.com> 1528489743 -0700
这显示了如果我没有设置这些环境变量,我是如何覆盖 会 的姓名和电子邮件地址的。
我有一个存储库,我在其中配置了本地 user.name
和 user.email
。我已经验证了 运行 git config user.name
和 git config user.email
在 git 仓库中给出了正确的输出,我的 .git/config
文件也正确地显示了它们 - 但是我的提交仍然使用我的全局 user.name
(尽管它们确实使用了正确的本地 user.email
)。我是 运行 macOS 10.13.4 和 Git 2.17.1 - 这个问题在命令行 git 和从 IntelliJ 提交时都会发生。可能是什么问题?
如果 git config user.name
打印出正确的名称但 git commit
没有使用该名称,则一定是某些东西覆盖了配置值。
明显的(咳嗽)候选者是 environment variable, as listed in the top level git
command manual page, most of the way to the end. You can do a quick test whether this is the case using the git var
command:
$ git var GIT_AUTHOR_IDENT | sed 's/@/ /'
Chris Torek <chris.torek gmail.com> 1528489689 -0700
对比:
$ GIT_AUTHOR_NAME='A U Thor' GIT_AUTHOR_EMAIL=thor@example.com git var GIT_AUTHOR_IDENT
A U Thor <thor@example.com> 1528489743 -0700
这显示了如果我没有设置这些环境变量,我是如何覆盖 会 的姓名和电子邮件地址的。