【问题标题】:Git not using user.nameGit不使用user.name
【发布时间】:2020-08-20 04:53:24
【问题描述】:

我以用户 bob 的身份通过 SSH 登录到 Linux 系统,并且拥有

$ git config --list --show-origin
file:/home/bob/.gitconfig     user.name=Robert DaBuilder
file:/home/bob/.gitconfig     user.email=robert.dabuilder@buildingsite.com
file:/home/bob/.gitconfig     color.ui=auto
file:.git/config        core.repositoryformatversion=0
file:.git/config        core.filemode=true
file:.git/config        core.bare=false
file:.git/config        core.logallrefupdates=true
file:.git/config        core.symlinks=false

当我提交某事时,我得到:

$ git commit -m "Add further text"
[master ad1cd5e] Add further text
Author: bob <robert.dabuilder@buildingsite.com>
1 file changed, 2 insertions(+)

那么在“作者”字段中,为什么使用我的登录名 bob 而不是 user.name

【问题讨论】:

    标签: linux git configuration git-commit


    【解决方案1】:

    git 使用环境变量GIT_AUTHOR_NAME 作为主要信息来源,如果未设置则使用配置值。

    【讨论】:

    • 谢谢,这帮助我在git-scm.com/docs/git-config 找到了信息。 GIT_AUTHOR_NAME 覆盖所有其他设置但git config --list --show-origin 未显示似乎有点不幸。还是有另一个命令可以做到这一点?
    • 您的意思是显示GIT_AUTHOR_NAME 值的命令吗?我不知道。
    猜你喜欢
    • 2018-08-30
    • 2011-05-17
    • 2013-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-29
    • 2021-01-11
    • 2021-02-16
    相关资源
    最近更新 更多