【问题标题】:Git in Terminal is using my real name for commits, how do I make it use my username instead?终端中的 Git 使用我的真实姓名进行提交,如何让它使用我的用户名?
【发布时间】:2016-10-01 19:29:53
【问题描述】:

当我从终端中的 git 提交文件到分支时,它显示提交是由我的真实姓名完成的。它是从哪里得到我的名字的,如何更改它以显示我的用户名?在我的 Github 设置中,我没有设置名称,git config --get user.name 返回我的 github 用户名。

【问题讨论】:

  • git config --list 告诉你什么?你能在那里找到你的全名吗?
  • 你也可以查看~/.gitconfig(全局配置)和.git/config(存储库配置)
  • 看了.gitconfig和git config --list,都没有我的真名。

标签: git github terminal


【解决方案1】:

当我从终端中的 git 提交文件到分支时,它显示提交是我的真实姓名完成的

这是从配置 user.name 和 user.email 设置的

在你的仓库中,确保:

git config user.name <yourGitHubAccountName>
git config user.email <yourGitHubAccountEmail>

然后进行新的提交,并使用 git log 查看他们的作者/电子邮件是否正确。


注意:正如我在“How do I make git block commits if user email isn't set?”中提到的,我更喜欢设置:

git config --global user.useConfigOnly true

这将避免 git 在未设置本地 user.name 时尝试猜测您的用户名。

【讨论】:

    猜你喜欢
    • 2014-05-15
    • 1970-01-01
    • 1970-01-01
    • 2011-02-05
    • 1970-01-01
    • 1970-01-01
    • 2021-06-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多