禁用 git credential-osxkeychain
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16052602/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
disable git credential-osxkeychain
提问by tompave
I need to disable the credential helper for OS X: git credential-osxkeychain
我需要禁用 OS X 的凭证助手: git credential-osxkeychain
It is disabled both in the global config file and in the local one, in fact it has neverben 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 willuse 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.
它在全局配置文件和本地配置文件中都被禁用,实际上它从未启用过。尽管如此,它仍会记住我的 github 登录详细信息。
我在笔记本电脑上,所以我不想自动无密码访问我的存储库。
我将使用 ssh 密钥。这是一台新电脑,整个系统设置仍在进行中。
现在我使用了https
repo refs,并且凭证助手不断地发挥作用。
These are my conf files:
这些是我的 conf 文件:
git config --edit
=>
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
=>
git config --global --edit
=>
[user]
email = ****************
name = tom
[color]
ui = true
[core]
editor = subl -w
[github]
user = tompave
[merge]
conflictstyle = diff3
[push]
default = simple
Also, running git config --global credential.helper
returns nothing (and that's right).
此外,运行git config --global credential.helper
不会返回任何内容(这是正确的)。
However, running git config credential.helper
returns osxkeychain
!
但是,运行git config credential.helper
返回osxkeychain
!
How is it possible? I can't see it in the local config file, where is it set?
这怎么可能?我在本地配置文件中看不到它,它在哪里设置?
I tried to set it up locally to see what would happen, and it didappear in the repodir/.git/config
. Then I deleted the entry... but the helper is still here and active.
我尝试在本地设置它以查看会发生什么,它确实出现在repodir/.git/config
. 然后我删除了该条目...但助手仍然在这里并处于活动状态。
I can clearly see its entry in OS X keychain.
I can delete it, and then gitwill 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.
我可以清楚地看到它在 OS X 钥匙串中的条目。
我可以删除它,然后git会再次要求输入密码......但是一旦我输入它(比如说,对于 a git fetch
),钥匙串中的条目就会恢复。
回答by John Szakmeister
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
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:
第一个检查本地 repo 配置,第二个是你的~/.gitconfig
,第三个是基于 git 的安装位置。根据哪个返回显示凭据助手,您可以尝试使用等效--unset
选项:
git config --local --unset credential.helper
git config --global --unset credential.helper
git config --system --unset credential.helper
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.
如果您没有适当的权限,最后一个可能不起作用。因此,您可能需要运行最后一个sudo
才能使其正常工作。FWIW,您可能已经为 Mac OS X 安装了预构建的 git 映像。如果您安装了cat /usr/local/git/etc/gitconfig
(或者/usr/local/etc/gitconfig
如果您通过 Homebrew 或本地建筑物安装了 git),您会看到它确实为您设置了凭证助手。所以上面的最后一个命令将有助于解决这个问题。
回答by Andrew Goodnough
The other answers were very helpful. The credential.helper didn't show for me in any of the listings (specifying --local, --global, etc) and it always showed on a 'git config -l'. Using the --show-origin command showed that it was coming from an OS X-specific file.
其他答案非常有帮助。credential.helper 没有在任何列表中显示(指定--local、--global 等),它总是显示在“git config -l”上。使用 --show-origin 命令显示它来自特定于 OS X 的文件。
$ git config --show-origin --get credential.helper
file:/Applications/Xcode.app/Contents/Developer/usr/share/git-core/gitconfig osxkeychain
回答by VonC
The config itself (git config --unset credential.helper
) isn't enough.
Make sure to kill any git-credential-osxkeychain
process (as described here) as well, or see if the issue persists after a reboot.
配置本身 ( git config --unset credential.helper
) 是不够的。
确保也终止任何git-credential-osxkeychain
进程(如此处所述),或者查看重新启动后问题是否仍然存在。
Also, when using GitHub for Mac, check if there is a config used internally by this tool.
Remember that git config
alone will check for system, global and local config file.
另外,当使用 GitHub for Mac 时,请检查是否有此工具内部使用的配置。
请记住,git config
单独检查系统、全局和本地配置文件。
Note: with git 2.9, you can simply set the credential.helper
to "empty string" in order to disable it: see "How do I disable git's credential helper for a single repository?".
注意:使用 git 2.9,您可以简单地将 设置credential.helper
为“空字符串”以禁用它:请参阅“如何为单个存储库禁用 git 的凭证助手?”。