gpt4 book ai didi

git - 如何在 git 配置中禁用 osxkeychain 作为凭证​​助手?

转载 作者:IT王子 更新时间:2023-10-29 00:46:17 28 4
gpt4 key购买 nike

我需要禁用 OS X 的凭证助手:git credential-osxkeychain

它在全局配置文件和本地配置文件中都被禁用,事实上它从不被启用。尽管如此,它仍然会记住我的 github 登录详细信息。
我在笔记本电脑上,所以我不想自动无密码访问我的存储库。
使用 ssh key 。这是一台新电脑,整个系统设置仍在进行中。
现在我使用了 https repo refs,凭证助手一直在运行。

这些是我的配置文件:


git config --edit =>

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = false
[remote "origin"]
url = https://github.com/user/repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "develop"]
remote = origin
merge = refs/heads/develop
[branch "deploy"]
remote = origin
merge = refs/heads/deploy

git config --global --edit =>

[user]
email = ****************
name = tom
[color]
ui = true
[core]
editor = subl -w
[github]
user = tompave
[merge]
conflictstyle = diff3
[push]
default = simple

此外,运行 git config --global credential.helper 不会返回任何内容(没错)。

但是,运行 git config credential.helper 会返回 osxkeychain!

这怎么可能?我在本地配置文件中看不到它,它在哪里设置?

我尝试在本地设置它以查看会发生什么,它确实出现在repodir/.git/config 中。然后我删除了条目...但是助手仍然在这里并且处于事件状态。

我可以清楚地看到它在 OS X 钥匙串(keychain)中的条目。
我可以删除它,然后 git 会再次要求输入密码...但是只要我输入它(比方说,对于 git fetch),条目在钥匙串(keychain)中恢复。

最佳答案

为了帮助追踪设置,我会尝试使用:

git config --local credential.helper
git config --global credential.helper
git config --system credential.helper

第一个检查本地 repo 配置,第二个是你的 ~/.gitconfig,第三个是基于 git 的安装位置。根据返回的显示凭据帮助程序的人,您可以尝试使用等效的 --unset 选项:

git config --local --unset credential.helper
git config --global --unset credential.helper
git config --system --unset credential.helper

如果您没有适当的权限,最后一个可能无法工作。因此,您可能需要在 sudo 下运行最后一个才能使其正常工作。 FWIW,您可能已经为 Mac OS X 安装了预构建的 git 镜像。如果您 cat /usr/local/git/etc/gitconfig (或 /usr/local/etc/gitconfig 如果你通过 Homebrew 或本地建筑安装了 git),你会看到它确实为你设置了凭证助手。所以上面的最后一个命令将有助于解决这个问题。

关于git - 如何在 git 配置中禁用 osxkeychain 作为凭证​​助手?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16052602/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com