[git] credential helper 让你的 https 不再需要输入用户名密码

版权声明:本文为博主原创文章,可以随意引用或转载,但未经博主允许不得用于任何商业用途。 https://blog.csdn.net/ustccw/article/details/84591578

参考: https://git-scm.com/book/zh/v2/Git-%E5%B7%A5%E5%85%B7-%E5%87%AD%E8%AF%81%E5%AD%98%E5%82%A8

介绍

在使用宇宙无敌最强版本管理 git 时, 如果使用 https 连接, 通常要求你输入 username & password.
那么如何可以不用每次都输入 username & password 呢?

  • 采用 SSH 连接方式
    前提当然你得有权限将自己主机 id_rsa.pub 加入到 git 账户的 SSH Keys
  • 采用 HTTPS 连接方式
    只要你有仓库访问权限即可, 使用本文即将介绍的 credential 来配置一下即可

配置 credential helper

存储配置到本地 ~/.my-credentials 文件

git config --global credential.helper store --file ~/.my-credentials

下一次 git pull/git push 时, 输入的 usernamepassword 将会被保存到 ~/.my-credentials 中;
以后再次 git pull/git push 将不再需要 usernamepassword .

猜你喜欢

转载自blog.csdn.net/ustccw/article/details/84591578
今日推荐