【问题标题】:I don't understerstand how I can use git with HTTPS without having to type in my password every time?我不明白如何在 HTTPS 中使用 git 而不必每次都输入密码?
【发布时间】:2022-11-02 03:15:51
【问题描述】:

据我所知,当您将 git 与 https 一起使用时,每次向 github 发出请求时都必须输入密码,除非您使用 SSH 或使用 git config credential.helper store 将凭据存储在本地计算机上。

我一直在使用 HTTPS,但从来不需要输入我的凭据。当我运行 git config --list 时,它只显示我的电子邮件和姓名,但不显示我的密码。谁能向我解释为什么我不需要输入密码或密码可以存储在哪里?

【问题讨论】:

  • 目标回购是私有的吗?如果没有,那么在没有凭据的情况下能够clonefetchpull 是正常的。他们将被要求push
  • 凭据不会显示在 git config --list 中(user.nameuser.email 仅用于提交的作者和提交者字段),它们将显示在 git remote -v 中(用于访问远程的 url)

标签: git


【解决方案1】:

我一直在使用 HTTPS,但从来不需要输入我的凭据。

那可能是因为您的凭据是已经由凭证助手缓存。

  1. 检查你的是什么:git config --global credential.helper
  2. 检查存储了哪些凭据:

    在 Git bash 会话中:

    printf "host=github.com
    protocol=https" | git-credential-xxx get
    

    xxx 替换为git config --global credential.helper 返回的值。

【讨论】:

  • git config --global credential.helper 没有返回任何东西(在我的 MacBook Air M1 上运行)
猜你喜欢
  • 2022-01-25
  • 2011-08-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多