如何避免pull和Fetch输入密码

linux和Mac的设置方法
  • step1:创建文件

    cd ~
    touch .git-credentials
    vim .git-credentials
    

    输入https://{username}:{password}@github.com

  • step2:在终端输入指令

    git config --global credential.helper store
    
  • step3:验证成功

    vim ~/.gitconfig
    

[credential] helper = store

Windows设置方法

方法基本与Linux相同,只是.git-credentials的文件需要放在在%HOME%目录中,一般为C:\users\Administrator,也可以是你自己创建的系统用户名目录,因为Windows无法创建.git-credentials,只能在git bash中建立。


results matching ""

    No results matching ""