参考:git
https://www.jianshu.com/p/77b0340a02f3缓存
https://blog.csdn.net/yunlong782/article/details/50887833?locationNum=7&fps=1spa
保存密码.net
git 有三种策略查找用户名密码:去缓存中找,去磁盘中找,去钥匙串中找。code
~/User/用户名/.gitconfig 中配置了Git查找密码的策略。cache/store/osxkeychain 分别对应上方三个策略blog
配置 Git 使用磁盘策略(可选参数 cache/store/osxkeychain)get
Window 系统下添加环境变量 %HOME% 指向任意目录,将会在指定目录下建立相关文件it
.gitconfig 文件中保存 Git 使用策略,.git-credentials 文件保存对应 URL 使用的账号密码io
git config --global credential.helper store
配置账号密码class
$ git config --global user.name "xxxxxx" $ git config --global user.email "xxxx@.com"
删除本地缓存
//查找系统支持的策略方式 git help -a | grep credential // credential.helper 字段中配置的即为 Git 查找策略 //查找 Git 的全局配置 git config --list //查看目前 Git 使用的策略 git config credential.helper //查看目前 Git 使用的策略所在目录,找到后能够直接删除 git config --show-origin --get credential.helper删除后参照保存本地密码能够再次设置 Git 查找策略与账号密码