1. 程式人生 > 實用技巧 >如何查詢修改本地git 賬號(增刪改查)

如何查詢修改本地git 賬號(增刪改查)

最近換了一臺其他同事的電腦,按照慣例,刪除本地的windows憑據,然後登陸自己的git賬號,本以為沒問題了,可是一連幾次提交程式碼都顯示的是原先的同事的賬號提交的,一臉懵逼。。。

向大佬問其故,大佬一句話:“你查詢一下本地的git賬號”

醍醐灌頂!遂作下文!

1 檢視

  1-1 檢視所有賬戶資訊

git config --list

  1-2 檢視指定賬戶資訊

$ git config user.name
$ git config user.email

2 新增

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

3 修改

  3-1 覆蓋的形式修改

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

  3-2 替換的形式修改

$  git config --global --replace-all user.name "yourName" 
$  git config --global --replace-all user.email "[email protected]"

4 刪除

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

此文感謝https://blog.csdn.net/huangxinglian/article/details/90694361的分享