业务服务器安全加固再也不容许使用我的私有key配置再服务器,为了配置调试方便使用https方式拉取代码,可是发现每次Git pull 、push 都要输入用户和密码,很不方便,特整理此配置。
会在用户家目录的.gitconfig文件中生成下面的配置。若是没有--global,则在当前项目下的.git/config文件中添加。 git config --global credential.helper store
默认记住15分钟: git config –global credential.helper cache 下面是自定义配置记住1小时: git config credential.helper ‘cache –timeout=3600’
cd /workspace/kdeploy git pull
[root@kdeploy]# git pull #输入git用户 Username for 'https://gitlab.com': kevin@pxxxx.com #输入git密码 Password for 'https://kevin@xxxxcom@gitlab.com':
成功首次代码拉取以后,在设置的缓存的时间周期内将不会再要求输入密码!git