Git配置用户名、邮箱

当安装完 Git 应该做的第一件事就是设置你的用户名称与邮件地址。

这样做很重要,因为每一个 Git 的提交都会使用这些信息,并且它会写入到你的每一次提交中,不可更改。

否则,用户名会显示为unknown,无法区分代码是开发团队中的哪个成员提交的。

一 检查配置

git config --get user.name
git config --get user.email

二 全局配置

git config --global user.name "John Doe"
git config --global user.email [email protected]

三 查看配置文件

Mac是~/.gitconfig文件:

vim ~/.gitconfig

Windows是 Users/用户/.gitconfig文件:

使用Notepad++查看。

猜你喜欢

转载自www.cnblogs.com/sea-breeze/p/11609838.html