設置當前項目的 git 用戶:
git config user.name myName // 自己的用戶名
git config user.email myEmail //自己的郵箱
git config --list //查看當前項目的 git 配置信息
在當前項目下面查看的配置是全局配置 + 當前項目的配置, 使用的時候會優先使用當前項目的配置。
也可以直接在項目的根目錄裏的 .git
文件夾裏,打開 config
文件查看當前項目的 git 配置信息:
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[submodule]
active = .
[remote "origin"]
url = https://github.com/DawnYu9/Test.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
在最後面添加該項目的用戶信息:
[user]
name = myName
email = myEmail
設置全局的 git 用戶:
git config --global user.name globalName // 全局的用戶名
git config --global user.email globalEmail // 全局的郵箱
git config --list // 查看配置信息