git记住密码

背景

每次推拉代码都需要输入用户名+密码,比较烦

通过config配置

必须是以http或者https提交数据才行

  1. 设置记住密码:
    git config --global credential.helper cache
    默认15分钟
  2. 如果想自己设置时间,可以这样做:
    git config --global credential.helper 'cache --timeout=3600'
    这样就设置一个小时之后失效
  3. 长期存储密码:
    git config --global credential.helper store

通过remote配置

  1. 移除远程ssh方式的仓库地址
    git remote rm origin

  2. 增加https远程仓库地址
    git remote add origin http://yourname:password@git.oschina.net/name/project.git

posted @ 2021-12-01 21:31  彩虹刀法  阅读(50)  评论(0编辑  收藏  举报