我使用以下内容配置全局Git:
git config --global user.name "My Name"
git config --global user.email "me@email.com"
如果我检查设置,一切似乎都没问题:
~$ git config -l
user.name=My Name
user.email=me@email.com
但是当我开始一个新项目(或签出另一个项目并提交一些内容)时,它并没有考虑这个配置:
~$ mkdir test
~$ cd test
~$ git init
~$ touch testfile
~$ git add testfile
~$ git commit -m "This is a test"
[master (root-commit) b090816] This is a test
Author: login <login@localdomain>
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 testfile
我尝试设置本地配置,但它也不起作用:
~$ git config user.name "My Name"
~$ git config --local -l
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
user.name=My Name
~$ touch anotherfile
~$ git add anotherfile
~$ git commit -m "This is another test"
[master 7f6a085] This is another test
Author: login <login@localdomain>
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 anotherfile
我的Git版本是2.5.1,我在GNU / Linux上运行。
任何帮助将不胜感激!