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 johndoe@example.com

 

三 查看配置文件

 

Mac是~/.gitconfig文件:

 

vim ~/.gitconfig

 

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

使用Notepad++查看。

 

posted on 2019-09-29 20:16  沙滩海风  阅读(3422)  评论(0编辑  收藏  举报

导航