我需要禁用OS X的凭证帮助程序: git credential-osxkeychain
它在全局配置文件和本地配置文件中都被禁用,实际上它从未启用过.它仍然记住我的github登录详细信息.
我在笔记本电脑上,所以我不希望自动无密码访问我的回购.
我将使用ssh密钥.这是一台新计算机,整个系统设置仍在进行中.
现在我使用了httpsrepo refs,凭证助手一直在努力.
这些是我的conf文件:
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
Run Code Online (Sandbox Code Playgroud)
git config --global --edit =>
[user]
email = ****************
name = tom
[color]
ui = true
[core]
editor = subl -w
[github]
user = tompave
[merge]
conflictstyle = diff3
[push]
default = simple
Run Code Online (Sandbox Code Playgroud)
此外,运行git config --global credential.helper没有返回任何东西(这是正确的).
但是,跑步git config credential.helper回归osxkeychain!
这怎么可能?我在本地配置文件中看不到它,它在哪里设置?
我尝试在本地设置它以查看会发生什么,它确实出现在repodir/.git/config.然后我删除了条目...但是帮助程序仍然在这里并且处于活动状态.
我可以清楚地看到它在OS X钥匙串中的输入.
我可以删除它,然后git会再次要求输入密码...但是一旦我输入密码(比方说,对于a git fetch),就会恢复钥匙串中的条目.
Joh*_*ter 84
为了帮助追踪设置,我尝试使用:
git config --local credential.helper
git config --global credential.helper
git config --system credential.helper
Run Code Online (Sandbox Code Playgroud)
第一个检查本地repo配置,第二个是你的~/.gitconfig,第三个是基于git的安装位置.根据哪一个显示凭证助手,您可以尝试使用等效--unset选项:
git config --local --unset credential.helper
git config --global --unset credential.helper
git config --system --unset credential.helper
Run Code Online (Sandbox Code Playgroud)
如果您没有适当的权限,最后一个可能无法正常工作.因此,您可能需要运行最后一个sudo才能使其正常工作.FWIW,您可能已为Mac OS X安装了预构建的git映像.如果您使用cat /usr/local/git/etc/gitconfig(或者/usr/local/etc/gitconfig如果您通过Homebrew或本地建筑物安装git),您将看到它确实为您设置了凭据帮助程序.所以上面的最后一个命令将有助于解决这个问题.
And*_*ugh 38
其他答案非常有帮助.在任何列表中都没有显示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
Run Code Online (Sandbox Code Playgroud)
小智 13
注意:在GitHub中,随着密码被弃用而代之以令牌,许多用户可能会再次出现此问题。
\n就我而言(macos 11.5 BigSur),命令行配置git config --unset credential.helper没有帮助,本地、全局或系统级别上也没有任何变化。GitHub 的帮助也没有解决问题。
解决方案是:
\n使用 查找配置文件,如上面Kim Tgit config --get-all --show-origin credential.helper提到的。您可能会得到并输出如下:\n \nfile:/usr/local/git/etc/gitconfig osxkeychainfile:/Users/XYZ/.gitconfig osxkeychain
如果您像我一样是 Mac 新手,您可能需要导航到文件位置。只需复制show-origin上述命令的每个输出,转到 Finder 并在“转到”菜单中选择“转到文件夹”,然后粘贴文件位置。
在每个配置文件中,注释掉osxkeychain,如下所示:
\n [credential]
\n helper = osxkeychain
\n 应变为
\n #[credential]
\n # helper = osxkeychain
\n您可能需要获得编辑文件的权限。要么使用sudo,或者在 Finder 中右键单击文件时转到菜单上的“获取信息”。
然后从存储库中推送或拉取。系统将再次要求您输入密码,但现在应该提供您的个人访问令牌。
\n瞧\xc3\xa0,魔法应该会发生。
\nKim*_*m T 10
在我的情况下,运行起来更容易:
git config --get-all --show-origin credential.helper
Run Code Online (Sandbox Code Playgroud)
它输出包括配置文件路径的完整列表:
file:/Library/Developer/CommandLineTools/usr/share/git-core/gitconfig osxkeychain
file:/Users/yourname/.gitconfig !aws codecommit credential-helper $@
Run Code Online (Sandbox Code Playgroud)
然后打开配置文件:
sudo vim /Library/Developer/CommandLineTools/usr/share/git-core/gitconfig
Run Code Online (Sandbox Code Playgroud)
并注释掉这一行 credential.helper=osxkeychain
| 归档时间: |
|
| 查看次数: |
35533 次 |
| 最近记录: |