Git:为每个 repo 设置不同的本地 user.name 和 user.email
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42167345/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git: Set local user.name and user.email different for each repo
提问by Pablo
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.
我目前正在处理 2 个项目,这些项目希望我在推送给它们时使用不同的数据配置我的本地用户名和电子邮件。
for that I'm updaing my config all the time like:
为此,我一直在更新我的配置,例如:
git config --local user.email "[email protected]"
git config --local user.email "[email protected]"
Since they are different repositories, is there a way I could define an local email for each repository?
由于它们是不同的存储库,有没有办法为每个存储库定义本地电子邮件?
Maybe in the .gitconfig
?
也许在.gitconfig
?
回答by gregory
For just one repo:
对于仅一个回购:
git config user.name "Your Name Here"
git config user.email [email protected]
For (global) default email (which is configured in your ~/.gitconfig):
对于(全局)默认电子邮件(在您的 ~/.gitconfig 中配置):
git config --global user.name "Your Name Here"
git config --global user.email [email protected]