如何修改 Git 已经提交记录的 用户名 和邮箱

145 阅读1分钟

step1、查看当前仓库的用户名和密码是不是符合需求的。

查看用户名: git config user.name

查看对应的邮箱: git config user.email

如果不正确,需要设置好。

更改您的 Git 作者身份

在 Git 中可以通过三种方式更改提交者身份。所有这些方法只影响未来的提交,而不影响过去的提交!

$ git config --global user.name "Your name"
$ git config --global user.email "xxxxxx@xxx.com"

更改单独存储库的提交者姓名和电子邮件

如果你只想在某个存储库中工作时使用特殊设置,你可以简单地省略 --global 标志。这使得配置仅在该存储库中有效:

$ git config user.name "Your name"
$ git config user.email "xxxxxx@xxx.com"