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

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


原理:git的全局配置,存儲於$HOME/.gitconfig 裏,這裏的配置影響當前用戶的所有git repo。


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

[user]
        name = Rocco
        email = [email protected]

方法2:

$ git config --global user.name 
$ git config --global user.email [email protected]



延伸:修改默認編輯器,修改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


發佈了26 篇原創文章 · 獲贊 28 · 訪問量 13萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章