本文介绍了Git:为每个仓库设置不同的本地user.name和user.email的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在从事2个项目,希望在我推送到它们时,我用不同的数据配置本地用户名和电子邮件.

I'm currently working on 2 projects, which expect that I configure my local username and email with different data when I push to them.

为此,我一直都在更新配置,例如:

for that I'm updaing my config all the time like:

git config --local user.email "namelastname@domain.com"

由于它们是不同的存储库,有没有办法为每个存储库定义本地电子邮件?

Since they are different repositories, is there a way I could define an local email for each repository?

也许在.gitconfig中?

推荐答案

仅需一个仓库:

git config user.name "Your Name Here"
git config user.email your@email.com

(全局)默认电子邮件(在您的〜/.gitconfig中配置):

For (global) default email (which is configured in your ~/.gitconfig):

git config --global user.name "Your Name Here"
git config --global user.email your@email.com

这篇关于Git:为每个仓库设置不同的本地user.name和user.email的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 05:49