【问题标题】:Disable osxkeychain credential helper in git as installed by Xcode在 Xcode 安装的 git 中禁用 osxkeychain 凭据帮助程序
【发布时间】:2014-10-21 16:36:57
【问题描述】:

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

我使用 git 安装在 OS X Mountain Lion 10.8.3 中的 Xcode Command Line Utilities 4.6.2 p>

在此安装中,git pullgit push 的默认行为是记住密码,从而使用户不必再次输入密码。

虽然方便,但在我的情况下这是一个安全风险。我需要禁用凭证助手,以便每个远程 pullpushfetch需要密码。

Xcode一起安装的git似乎没有使用git config来设置这个功能。这是我的设置:


# git --version =>

git version 1.7.12.4 (Apple Git-37)

# git config --global --list =>

user.name=User Name
user.email=user@home
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=auto
color.ui=auto
alias.lol=log --pretty=oneline --abbrev-commit --graph --decorate
alias.co=checkout
alias.ci=commit
alias.st=status
alias.br=branch
alias.hist=log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
alias.type=cat-file -t
alias.dump=cat-file -p
core.autocrlf=input
core.safecrlf=true
core.editor=/usr/bin/vim

# git config --local --list =>

core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=https://XXXXXXX@bitbucket.org/YYYYYYYY/ZZZ.git
branch.master.remote=origin
branch.master.merge=refs/heads/master

# git config --system --list =>

fatal: unable to read config file '/usr/etc/gitconfig': No such file or directory

[ 注意:我的安装没有系统配置文件。 ]


我在 Stack OverflowGoogle 上进行了彻底搜索,但找不到在此安装中禁用凭据帮助程序的解决方案。

我怀疑 Xcode 层次结构中某处有一个 .plist 或类似的配置文件,它有一个要禁用的标志,但在 gitXcode 文档。

一个快速而肮脏的解决方案是 chmod Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-credential-osxkeychain 二进制文件,但这不是很优雅,并且可能会因 Xcode 的任何更新而中断。

有没有任何 Xcode 专家知道 Apple 将标志隐藏在哪里以关闭此 git 功能?

【问题讨论】:

标签: xcode macos git osx-mountain-lion keychain


【解决方案1】:

如果您问题的主要关注点是安全性,并且您希望每次都输入密码,那么我会采用钥匙串来满足您的目标

  1. 进入osx钥匙串应用,
  2. 如果您使用的是 https,请查找服务器名称
  3. 通过单击更改其设置,然后在“访问控制”选项卡下标记“询问钥匙串密码”
  4. 如果需要,从白名单应用程序列表中删除 git-credential-osxkeychain 应用程序。 (就我而言,此时我必须保存,返回设置并重新启用“询问钥匙串密码”,该功能再次以某种方式被禁用。)

请注意,在 Linux 上,默认行为也是自动发送凭据。

【讨论】:

    猜你喜欢
    • 2013-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-19
    • 1970-01-01
    • 2012-09-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多