Git 使用 PBIS Active Directory 电子邮件提交,而不是 git 配置的电子邮件

Git commits using PBIS Active Directory email, not git-configured email

我公司的台式计算机使用 PBIS 使我的 Active Directory 用户在 Linux (Ubuntu) 桌面上可用。似乎 Git 正在使用我的 Active Directory 凭据作为我的电子邮件地址,尽管我非常确定 Git 配置正确。见证电子邮件地址 FOOBAR\dotan@dotan-tm.foobar.local 正在被使用,即使表面上我已将 Git 配置为使用地址 github-com-2010.04@dotancohen.com:

$ whoami
FOOBAR\dotan

$ cat .git/config | grep email
    email = github-com-2010.04@dotancohen.com

$ echo $GIT_AUTHOR_EMAIL

$ echo $GIT_COMMITTER_EMAIL

$ git commit --amend -am "Add information for Unity desktop"
[master ed323a1] Add information for Unity desktop
 Author: Dotan Cohen <FOOBAR\dotan@dotan-tm.foobar.local>
 Date: Sun Jan 17 09:29:43 2016 +0200
 1 file changed, 20 insertions(+), 1 deletion(-)

$ git config user.email github-com-2010.04@dotancohen.com

$ git commit --amend -am "Add information for Unity desktop"
[master 2a8ed96] Add information for Unity desktop
 Author: Dotan Cohen <FOOBAR\dotan@dotan-tm.foobar.local>
 Date: Sun Jan 17 09:29:43 2016 +0200
 1 file changed, 20 insertions(+), 1 deletion(-)

$ git config --global user.email github-com-2010.04@dotancohen.com
$ export GIT_AUTHOR_EMAIL='github-com-2010.04@dotancohen.com'
$ export GIT_COMMITTER_EMAIL='github-com-2010.04@dotancohen.com'

$ echo $GIT_AUTHOR_EMAIL
github-com-2010.04@dotancohen.com

$ echo $GIT_COMMITTER_EMAIL
github-com-2010.04@dotancohen.com

$ git commit --amend -am "Add information for Unity desktop"
[master b2800f2] Add information for Unity desktop
 Author: Dotan Cohen <FOOBAR\dotan@dotan-tm.foobar.local>
 Date: Sun Jan 17 09:29:43 2016 +0200
 1 file changed, 20 insertions(+), 1 deletion(-)

如何配置 Git 以使用正确的电子邮件地址进行提交?

您正在修改您的提交。因此,使用旧的作者姓名。要使用您的新名称(和邮件地址),请使用 git commit --reset-author.