正如其他答案中提到的,Seahorse 是一个图形界面前端,用于访问相同的密钥环,但也有一个称为 secret-tool 的命令行界面前端,可以访问相同的内容。
不需要摆弄 git 凭证助手后面的东西。
任何 git 凭证助手都支持“擦除”方法,例如在
contrib/credential/libsecret/git-credential-libsecret.c
的源代码中所示。
static struct credential_operation const credential_helper_ops[] = {
{ "get", keyring_get },
{ "store", keyring_store },
{ "erase", keyring_erase },
CREDENTIAL_OP_END
};
因此,要删除凭据条目,您需要键入:
printf "protocol=https\nhost=github.com\nusername=<me>" | \
git-credential-libsecret erase
将“github.com
”和<me>
替换为实际的远程站点和远程帐户用户名。
如果您的凭据助手不是libsecret
,而是“manager-core
”(使用跨平台的Microsoft GCM),则应该是:
printf "protocol=https\nhost=github.com\nusername=<me>" | \
git-credential-manager-core erase
如果您的凭证助手不是libsecret
,而是其他助手,如"store
"、"cache
"等:
printf "protocol=https\nhost=github.com\nusername=<me>" | \
git-credential-xxx erase
只需输入你的凭证辅助命令: 它就会显示其命令。
在我的情况下:
git-credential-manager-core
Required command was not provided.
Usage:
git-credential-manager-core [options] [command]
Options:
--version Show version information
-?, -h, --help Show help and usage information
Commands:
get [Git] Return a stored credential
store [Git] Store a credential
erase [Git] Erase a stored credential
configure Configure Git Credential Manager as the Git credential helper
unconfigure Unconfigure Git Credential Manager as the Git credential helper
azure-repos Commands for interacting with the Azure Repos host provider
请确保它在您的$PATH
中(如果不在:/usr/lib/git-core
,则应该在/usr/bin
)
旧版本的帮助程序可能无法显示所有“操作”命令,并使用erase
的旧同义词(remove
或delete
)
要检查erase
/remove
/delete
是否起作用,请先显示您存储的密码("get
"),然后执行"erase
",然后尝试再次显示它,再次使用"get
"操作:
printf "protocol=https\nhost=github.com\nusername=<me>" | \
git-credential-xxx get
如果提示您输入用户名/密码,则表示您已成功删除缓存条目。