git之https或http方式设置记住用户名和密码的方法

https方式每次都要输入密码,按照以下设置便可输入一次就不用再手输入密码的困扰并且又享受https带来的极速git

设置记住密码(默认15分钟):ssh

git config --global credential.helper cache

若是想本身设置时间,能够这样作:.net

git config credential.helper 'cache --timeout=3600'

这样就设置一个小时以后失效rem

长期存储密码:it

git config --global credential.helper store

增长远程地址的时候带上密码也是能够的。(推荐)class

http://yourname:password@git.oschina.net/name/project.git

补充:使用客户端也能够存储密码的。file

若是你正在使用ssh并且想体验https带来的高速,那么你能够这样作: 切换到项目目录下 :密码

cd projectfile/

移除远程ssh方式的仓库地址im

git remote rm origin

增长https远程仓库地址客户端

git remote add origin http://yourname:password@git.oschina.net/name/project.git

搞定,enjoy the speed!

相关文章
相关标签/搜索