git pull 时每次都要输入用户名和密码的解决办法

git clone的下载代码的时候用https://而不是git@git (ssh)的形式,当我们操作git pull/push到远程的时候,总是提示我们输入账号和密码才能操作成功,频繁的输入账号和密码会很麻烦。

解决办法:
git bash进入你的项目目录,输入(作者测试了这个方法,的确好用!):

git config credential.helper store

如果是要求全局配置那就

git config --global credential.helper store

这样会在你本地生成一个文本,上边记录你的账号和密码。

使用上述的命令配置好之后,再操作一次git pull操作,它会提示你输入账号密码,这一次之后就不需要再输入密码了。

如果你之前不小心配置了全局的话,切换到你项目所在的目录下

//删除 store 配置
git config --global --unset credential.helper store
//添加 store 配置
git config credential.helper store

当然配置manager的存储方式也是可以的

//删除 manager配置
git config --global --unset credential.helper manager
//添加manager配置
git config --global credential.helper manager

THE END