在Git的每用户配置文件中设置的名称和电子邮件,但Git仍在使用默认生成的名称和电子邮件。我还应该看看

时间:2015-12-17 23:33:49

标签: git

当我使用git时,我无法摆脱警告:

 Committer: Dominic Mayers <dominic@tmorg.ca>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email you@example.com

如果我将电子邮件更改为dominic@tmorg.ca,则无效。也许答案就像那里提供的答案一样简单Name and email set in Git's per-user configuration file, however Git is still using the default generated name and email。一定是我犯了一个愚蠢的错误,但我看不出来。这是$ git config --global --list

的输出
user.mail=admin@tmorg.ca
user.name=Dominic Mayers

注意添加:愚蠢的错误是我使用mail而不是email

.git/config

的内容
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "donation"]
        url = dominic@192.155.90.64:/var/www/donation.git
        fetch = +refs/heads/*:refs/remotes/donation/*
[user]
        mail = admin@tmorg.ca
        name = Dominic Mayers

ls -la .git

的输出
drwxrwxr-x  2 dominic git                  4096 Dec 17 15:04 branches
-rw-rw-r--  1 dominic dominic               279 Dec 17 18:07 COMMIT_EDITMSG
-rw-rw-r--  1 dominic dominic               263 Dec 17 17:41 config
-rw-rw-r--  1 dominic git                    73 Dec 17 15:19 description
-rw-r--r--  1 dominic git                    93 Dec 17 15:36 FETCH_HEAD
-rw-rw-r--  1 dominic git                    23 Dec 17 15:19 HEAD
drwxrwxr-x  2 dominic git                  4096 Dec 17 15:04 hooks
-rw-rw-r--  1 dominic dominic             16080 Dec 17 17:43 index
drwxrwxr-x  2 dominic git                  4096 Dec 17 15:04 info
drwxr-xr-x  3 dominic git                  4096 Dec 17 15:19 logs
drwxrwxr-x 28 dominic git                  4096 Dec 17 18:07 objects
-rw-rw-r--  1 dominic dominic                41 Dec 17 15:36 ORIG_HEAD
drwxrwxr-x  5 dominic git                  4096 Dec 17 15:19 refs

我还应该注意什么?

1 个答案:

答案 0 :(得分:0)

尝试检查local / system / global

的配置值
git config --global --get user.name
git config --system --get user.name
git config --local --get user.name

正如mipadi所提到的,你似乎用本地配置覆盖了全局配置。将其删除:

git config --local --unset user.name

并检查user.name现在是否正确:

git config --get user.name

对user.email执行相同的操作