git记住密码
背景
每次推拉代码都需要输入用户名+密码,比较烦
通过config配置
必须是以http或者https提交数据才行
- 设置记住密码:
git config --global credential.helper cache
默认15分钟 - 如果想自己设置时间,可以这样做:
git config --global credential.helper 'cache --timeout=3600'
这样就设置一个小时之后失效 - 长期存储密码:
git config --global credential.helper store
通过remote配置
-
移除远程ssh方式的仓库地址
git remote rm origin
-
增加https远程仓库地址
git remote add origin http://yourname:password@git.oschina.net/name/project.git
本文来自博客园,作者:彩虹刀法,转载请注明原文链接:https://www.cnblogs.com/listen80/p/15630815.html