【问题标题】:Finding Where Git Credentials Stored查找 Git 凭证的存储位置
【发布时间】:2020-10-05 22:27:03
【问题描述】:

我遇到了一个奇怪的情况,我想知道如何才能推送到回购。

我有 2 个 repos,一个是 public,另一个在公司的 Github Enterprise 下。好吧,我刚刚从企业一号克隆了一个 HTTPs 回购链接,一切正常,通常不需要任何凭据。

但是,当我意识到我也可以推送时,我开始想知道凭据存储在哪里。我查了.git/config

remote "origin"]
    url = https://mygithub.blablacompany.com/blablaUsername/blabla.git
    fetch = +refs/heads/*:refs/remotes/origin/*

然后我检查了 git config --list ,列出了一堆其他 repo 用户名以及:

remote.origin.url=https://mygithub.blablacompany.com/blablaUsername/blabla.git
remote.origin.fetch=+refs/heads/*:refs
branch.master.remote=origin
branch.master.merge=refs/heads/master

然后我检查了./git-credentials 是否存在于主文件夹中。不,它没有。我在本地盘找遍了,不存在。

然后我检查了 Windows 的 git 凭据管理器是否存在:

> git credential-manager version
> Git Credential Manager for Windows version 1.6.1

好的,我假设它存储在 Windows 凭据中。但是当我转到用户凭据时,我看不到任何记录,也没有关于 git。

我尝试运行git config credential.helper,它返回:

!github --credentials

所以我假设感叹号后面的所有内容都是一个 shell 命令。好的,所以我尝试检查/Users/Me下的全局配置:

有一个,但它完全用于另一个非企业回购。

那么我怎么能推送到这个 repo 呢?如何追踪密码/ssh 密钥的存储位置?

【问题讨论】:

  • 请执行 git config -l 看看您是否在此处设置了密码或是否存储了凭据机制。

标签: git github passwords credentials github-enterprise


【解决方案1】:

您可以查看所有 Git 设置、文件和文件位置,

git config --list --show-origin

【讨论】:

    猜你喜欢
    • 2018-05-24
    • 2020-01-13
    • 1970-01-01
    • 1970-01-01
    • 2020-03-05
    • 2020-11-16
    • 1970-01-01
    • 2015-03-22
    • 2013-08-08
    相关资源
    最近更新 更多