1、特定項目設置用戶名/郵箱/密碼的方法git
找到項目所在目錄下的 .git,進入.git文件夾,而後執行以下命令分別設置用戶名和郵箱code
git config user.name "dawn.he" git config user.email "123333333@qq.com"
而後執行命令查看config文件:cat configrem
cat config
發現裏面多了剛纔配置的用戶名和郵箱信息user,即成功爲該項目單獨設置了用戶名和郵箱get
... [branch "master"] remote = origin merge = refs/heads/master [user] name = dawn.he email = 123333333@qq.com
若是git pull 每次都要求輸入用戶名和密碼,則能夠執行以下配置it
git config credential.helper store
執行後, cat config查看,則多了credential的內容:ast
[user] name = Affandi email = 123333333@qq.com [credential] helper = store
而後再回到項目目錄下執行git pull/push,根據提示輸入用戶名和密碼,輸入正確後,之後再執行git pull/push 就不用輸入用戶名和密碼了email
2、設置全局用戶名/郵箱配置
設置全局用戶名/郵箱密碼
git config --global user.name "hexiaoming" git config --global user.email "hexiaoming@hh.com"方法
查看設置
git config --list