git http设置记住密码

git http设置记住密码

默认http/https 每次都需要手动输入密码,解决繁琐输入密码:

1、第一种设置git参数

#全局设置记住密码 默认15分钟
git config --global credential.helper cache

#自定义时间,单位:秒-eg:1天
git config credential.helper 'cache --timeout=86400'

#永久存储:
git config --global credential.helper store

2、默认携带

#http中默认携带
git clone http://name:password@github.com/name/project.git

需注意:第二种方式如果用户名/密码中有@符号会出错,所以urlencode进行处理,处理后@符号会变为%40,问题解决。

发表评论