【Mac使用基础】git config 全局配置,user.name和user.email 设置

来源:互联网 发布:红楼梦 贾元春 知乎 编辑:程序博客网 时间:2024/05/20 06:25

需求:今天需要对我的 git 提交的信息中的 name 和 email 进行修改;


原理:git的全局配置,存储于$HOME/.gitconfig 里,这里的配置影响当前用户的所有git repo。


方法1: 直接修改 $HOME/.gitconfig 文件,增加下面内容;

[user]        name = Rocco        email = handsomerocco@gmail.com

方法2:

$ git config --global user.name $ git config --global user.email handsomerocco@gmail.com



延伸:修改默认编辑器,修改Alias等,最终都保存在 $HOME/.gitconfig


需求:今天需要对我的 git 中的 显示颜色方案 进行修改;


git config --global color.diff auto # git diff 要顯示顏色git config --global color.status auto # git status 要顯示顏色git config --global color.branch auto


原创粉丝点击