[英]List git credentials from credential helper
似乎是一個簡單的問題,但我找不到解決方案,在存儲在緩存中的git 配置憑據(用戶名和個人訪問令牌)中, git config --list
像這樣返回憑據信息
credential.helper=cache
是否可以從緩存中看到憑據,我嘗試了以下三個位置
(repository_home) /.git/config
- 沒有關於用戶名和密碼的信息
~/.gitconfig
- 在 repo 文件夾中找不到文件
從git-credential git credential fill
在這里可能會有所幫助,您需要輸入主機和協議詳細信息以獲取用戶名和密碼。
$ git credential fill
protocol=https
host=example.com
Output:
protocol=https
host=example.com
username=bob
password=secret
您可以從憑證助手查詢一組特定的憑證,但憑證助手協議中沒有允許您查詢所有憑證的部分。 一般來說,這很難,因為憑證助手可以響應與模式匹配的所有憑證,例如https://*.example.org
或https://github.com/bk2204/*
,並且該模式不需要匹配任何可以表達的簡單模式(例如,幫助程序可以非常了解用戶基於 LDAP 可以訪問哪些存儲庫)。
對於cache
憑證助手,沒有辦法枚舉這些憑證。
如果要查找特定 URL 的憑據,最簡單的方法是:
echo url=https://github.com/git/git.git | git credential fill
這將打印任何憑證助手都知道的憑證。 您可以在gitcredentials(7)
手冊頁中查看有關該協議的更多信息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.