git指定仓库使用特定用户名提交

需求

使用工作电脑配置了全局git用户名和公司email
更新github个人仓库时不希望commit暴露工作邮箱和姓名

实现

对repo配置local设置,指定提交时的用户名和邮箱

git config user.name nickname
git config user.email mail@github.com

改动将被保存在.git/config[user]字段

See also

git使用指定ssh key - azureology - 博客园

原文地址:https://www.cnblogs.com/azureology/p/15624813.html