局部配置,针对具体项目,在项目目录下运行命令:
git config user.name "worker95"
git config user.email "worker95@work.com"
查看项目的局部配置,在项目目录下运行:
git config user.name
git config user.email
全局配置(只是多了一个--global参数):
git config --global user.name "user95"
git config --global user.email "user95@foxmail.com"
查看全局配置:
git config --global user.name
git config --global user.email
Git的提交记录中会包含提交者的用户名和邮箱,而且不同项目可能也要用到不同的用户名或邮箱,如公司和个人项目可能就需要区分。
如果配置了全局用户名邮箱,则对所有项目生效。如果项目配置了局部用户名邮箱,则会覆盖掉全局配置,项目会优先采用局部配置的信息。
版权声明:本文为c1024197824原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。