更改 git 用户名

Change git username

我几个月前玩过 git bash,我不知道我怎么不小心把我的名字设置为 "Your-Name"( =/ )。

现在每次我对我的存储库进行更改时,都会显示 "your-name" 提交更改。

顺便说一句 - 如果我通过 android studio 创建一个回购协议,它显示我的实际用户名创建了回购协议,但如果我提交任何更改并推送它显示像 "Your-Name" 提交更改。

我该如何解决这个问题并更改为我实际的 github 用户名?

根据documentation,打开一个git bash提示一个运行:

$ git config --global user.name "First Last"

您可以看到如下配置信息。 Refer to Git documentation

$ git config --list
user.name=John Doe
user.email=johndoe@example.com
color.status=auto
color.branch=auto
color.interactive=auto
color.diff=auto
...

配置信息你的用户名,邮箱

$ git config user.name
$ git config user.email

要在所有存储库中全局更改您的设置:

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

仅将您的设置更改为当前存储库:

$ git config --local user.name "John Doe"  #if you omit --local also, by default it is local
$ git config --local user.email johndoe@example.com #if you omit --local also, by default it is local