【问题标题】:Where is github authentication token stored on Windows?Windows 上的 github 身份验证令牌存储在哪里?
【发布时间】:2019-10-07 03:48:18
【问题描述】:

如果我在私有存储库上运行类似于以下的命令:

git ls-remote https://github.com/org/repo.git

我收到以下提示。

我正在使用https://gitforwindows.org 并查看进程资源管理器,生成此窗口的可执行文件似乎是\mingw64\libexec\git-core\git-credential-manager.exe,相对于 Git for Windows 安装文件夹。

当我输入凭据时,我收到了来自 Github 的电子邮件,说创建了一个新的身份验证令牌。

此令牌存储在我的 PC 上的什么位置?当我重复上面的命令时,我不再收到提示 - 只要我不撤销 github 网站上的令牌。

【问题讨论】:

    标签: windows git github


    【解决方案1】:

    默认情况下,Git 将使用 Windows Credential Manager 通过 Github for Windows 桌面存储和检索 Git 凭据。

    凭据管理器可让您查看和删除已保存的用于登录网站、连接的应用程序和网络的凭据。

    要打开凭据管理器,请在任务栏的搜索框中输入凭据管理器,然后选择凭据管理器控制面板。 选择 Web 凭据Windows 凭据 以访问您要管理的凭据。

    您将在 Windows 凭据 选项卡上找到 GitHub - https://api.github.com/{username} 条目。

    【讨论】:

      【解决方案2】:

      迈克·麦金托什是对的。以下是访问令牌的方法。

      Install-Module CredentialManager -Scope AllUsers -Force
      

      根据自己的喜好更改上述命令的标志。那么:

      Get-StoredCredential -AsCredentialObject | %{$_} `
        | ?{ $_.targetName -like "*github.com*"} `
        | sort LastWritten `
        | select LastWritten,Targetname,Password
      

      这将为您提供您可能已创建的令牌列表。使用Get-Command -Module CredentialManager 列出模块上所有可用的命令,您可以使用它来操作凭证存储。

      【讨论】:

      • 很好的助攻,加油!
      猜你喜欢
      • 1970-01-01
      • 2012-08-31
      • 1970-01-01
      • 2012-09-24
      • 1970-01-01
      • 2014-06-21
      • 2018-11-23
      • 1970-01-01
      • 2020-04-10
      相关资源
      最近更新 更多