1.配置用戶名密碼。分爲設置全局和局部,我們直接設置全局的。
#設置局部的話,直接去掉 --global 選項即可
git config --global user.name "你的username"
git config --global user.email "你的email"
如果換了賬號密碼,用--replace-all
替換全部
git config --global user.name "你的新的username"
git config --global user.email "你的新的email"
查看配置是否修改成功
# 用 --list
git config --list
# 或直接看配置文件
vi ~/.gitconfig
2.避免重複輸入密碼。上面做完之後,下次提交時還需要重複輸入密碼,用下面方法解決
git config --global credential.helper store