我目前正在开发 2 个项目,这些项目希望在推送到它们时使用不同的数据配置本地用户名和电子邮件。为此,我一直在更新我的配置,例如:
git config --local user.email "[email protected] /cdn-cgi/l/email-protection"
由于它们是不同的存储库,有没有办法可以为每个存储库定义本地电子邮件?
也许在.gitconfig
?
对于仅一个存储库,请进入相关存储库 DIR 并:
git config user.name "Your Name Here"
git config user.email [email protected] /cdn-cgi/l/email-protection
对于(全局)默认电子邮件(在 ~/.gitconfig 中配置):
git config --global user.name "Your Name Here"
git config --global user.email [email protected] /cdn-cgi/l/email-protection
您可以通过以下方式检查您的 Git 设置:git config user.name && git config user.email
如果您在特定的存储库中设置了新的用户/配置(与全局不同),那么它应该显示本地配置,否则它将显示您的全局配置。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)