少用少见的 - pull 的时候不再输入账密

  • 作者:KK

  • 发表日期:2020.05.25


问题场景

用 https 的项目链接地址拉代码的时候会每次都要求输入账号密码来认证。


解决步骤

  1. 执行git config --global credential.helper store

    这时候~/.gitconfig文件的末尾会多出这样的内容:

    [credential]
    helper = store
    
  2. 执行git pull再次输入用户名和密码

    然后你会看到 ~/.git-credentials这个文件会多一行内容。里面的内容类似https://{username}:{password}@github.com这种形式,就在这里记住了你的账号密码,下次不需要再输入了。

再拉代码试试吧。