如何在 git config 中禁用 osxkeychain 作为凭证​​助手? [英] How to disable osxkeychain as credential helper in git config?

查看:23
本文介绍了如何在 git config 中禁用 osxkeychain 作为凭证​​助手?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need to disable the credential helper for OS X: git credential-osxkeychain

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

It is disabled both in the global config file and in the local one, in fact it has never ben enabled. Still, it keeps memorizing my github login details.
I'm on a laptop, so I don't want automatic passwordless access to my repos.
I will use ssh keys. This is a new computer, and the whole system setup is still a work in progress.
For now I used the https repo refs, and the credential helper keeps kicking in.

这些是我的配置文件:

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 不会返回任何内容(这是正确的).


Also, running git config --global credential.helper returns nothing (and that's right).

然而,运行 git config credential.helper 返回 osxkeychain

However, running git config credential.helper returns osxkeychain!

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

How is it possible? I can't see it in the local config file, where is it set?

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

I tried to set it up locally to see what would happen, and it did appear in the repodir/.git/config. Then I deleted the entry... but the helper is still here and active.

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

I can clearly see its entry in OS X keychain.
I can delete it, and then git will ask for the password again... but as soon as I type it (let's say, for a git fetch), the entry in keychain is restored.

推荐答案

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

To help track down the setting, I'd try to use:

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

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

The first one checks the local repo config, the second is your ~/.gitconfig, and the third is based on where git is installed. Depending on which one comes back showing the credential helper, you can try using the equivalent --unset option:

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),您会看到它确实为您设置了凭证助手.所以上面的最后一条命令将有助于解决这个问题.

The last one may not work if you don't have proper permissions. So you may need to run the last one under sudo for it to work correctly. FWIW, you may have installed for the pre-built git images for Mac OS X. If you cat /usr/local/git/etc/gitconfig (or /usr/local/etc/gitconfig if you installed git via Homebrew or a building locally), you'll see that it does set up the credential helper for you. So the last command above would help fix that problem.

这篇关于如何在 git config 中禁用 osxkeychain 作为凭证​​助手?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆