局部配置,针对具体项目,在项目目录下运行命令:

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的提交记录中会包含提交者的用户名和邮箱,而且不同项目可能也要用到不同的用户名或邮箱,如公司和个人项目可能就需要区分。

如果配置了全局用户名邮箱,则对所有项目生效。如果项目配置了局部用户名邮箱,则会覆盖掉全局配置,项目会优先采用局部配置的信息。

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐