10月28, 2019

Git实现免密使用Http/Https协议拉去代码

一、查看支持的Credential Helper

Linux:

  1. git help -a | grep credential

Windows:

  1. git help -a | findstr credential

二、设置Credential Helper

凭据可以设置为全局,也可以设置为仅仅在当前的项目下起作用。
如果想使用全局,则设置为:

  1. git config global credential.helper store file=git_credentails.

如果仅仅设置当前项目有效,则进入项目代码目录下,运行:

  1. git config credential.helper store file=.git_credentails.

上面的–file=.git-credentials表示你的用户名密码存储的文件目录结构,即存放在哪里由你指定。
查看配置文档

  1. git help credential-store
  2. git help credential-cache

三、查看配置

Linux:

  1. git config list | grep credential

Windows:

  1. git config list | findstr credential

四、清除账号

  1. git config --system --unset credential.helper

五、同步测试

进行一次push操作,首次执行输入一次密码,再次执行就不需要再输入密码了

本文链接:https://lxyit.com/article/show/217.html

-- EOF --