當安裝完 Git 應該做的第一件事就是設置你的用戶名稱與郵件地址。
這樣做很重要,因為每一個 Git 的提交都會使用這些信息,並且它會寫入到你的每一次提交中,不可更改。
否則,用戶名會顯示為unknown,無法區分代碼是開發團隊中的哪個成員提交的。
一 檢查配置
git config --get user.name
git config --get user.email
二 全局配置
git config --global user.name "John Doe" git config --global user.email johndoe@example.com
三 查看配置文件
Mac是~/.gitconfig文件:
vim ~/.gitconfig
Windows是 Users/用戶/.gitconfig文件:
使用Notepad++查看。