業務服務器安全加固再也不容許使用我的私有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