【原创】解决github每次提交代码时总要输入用户名和密码的问题
问题背景:
每次github提交代码时总是提示需要输入用户名和密码,很麻烦,很低效。
问题原因:
- github安全所致
- github没有缓存用户名和密码
解决方案:
A. 首先执行命令 git config:
git config --global credential.helper storegit config --global 命令实际上在操作用户家目录下的 /path/to/.gitconfig文件, 并且在 /path/to/.gitconfig 文件的末尾新增如下一行:
[credential] helper = storeB. 再次执行命令 git push:
再次执行完 git push 后,本次github依然会要求我们再输一次用户名和密码进行鉴权,于此同时还会在用户的家目录下生成 /path/to/.git-credential 文件以缓存记录鉴权信息,因此之后git push代码就再也不用每次都输入用户名和密码啦。
关于.gitconfig内容:
[http] sslVerify = false [user] name = *** email = ***@163.com [credential] helper = store
官方参考:
https://help.github.com/articles/set-up-git/#password-caching
版权声明:除非注明,本文由( blogdaren )原创,转载请保留文章出处。
发表评论: