如何禁用单个存储库的git的凭证助手? [英] How do I disable git's credential helper for a single repository?

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

问题描述

如果我在〜/ .gitconfig 中设置了凭证助手,如何禁用/绕过特定的回购并使用 no 证书助手?



我试着编辑repo的 .git / config 文件来清空 credential.helper 属性如下:

  [凭证] 
助手=

...但是当我做一个 git push 我收到以下错误消息,Git使用我的默认凭据助手从〜/ .gitconfig :无论如何:

  git:'credential-'不是git命令。参见'git --help'。 

你的意思是?
凭证

我使用git 1.7.12版。



(Backstory / use case:Git被配置为使用 store helper,该助手将密码存储在磁盘上未加密。 cache helper在这个系统上是不可用的。我有一个repos,我宁愿每次输入密码都要保存在磁盘上。)

helper = )实际上可以工作!



请参阅提交2432137 (2016年2月26日) Jeff King( peff

(由Junio C Hamano - gitster - commit 1b68962 ,2016年4月3日)


credential.helper 配置变量是累积性的,并且没有从命令行覆盖它的好方法。

作为特例, strong>给出一个空字符串,因为它的值现在用作清除各种文件中指定值的信号。
$ b

凭证:让空凭证规范重置帮助程序列表



由于 credential.helper 键是多值配置列表,一旦设置好帮助器,就无法解除它。因此,如果你的系统 /etc/gitconfig 设置了一个,你永远不能避免运行它,只能在你自己的顶部添加你自己的helper。



由于 credential.helper 的空值是无意义的(它只会尝试运行 git-credential - ),我们可以假设没有人使用它。让我们来定义它来重置帮助程序列表,让您覆盖
之前的优先级较低的实例。



If I have a credential helper set in my ~/.gitconfig, how can I disable/bypass it in a specific repo and use no credential helper?

I've tried editing the repo's .git/config file to blank out the credential.helper property like this:

[credential]
    helper = 

... but when I do a git push I get the following error message, and Git uses my default credential helper from ~/.gitconfig anyway:

git: 'credential-' is not a git command. See 'git --help'.

Did you mean this?
        credential

I'm using git version 1.7.12.

(Backstory/use case: Git is configured to use the store helper, which stores passwords unencrypted on disk. The cache helper is unavailable on this system. I have a couple repos for which I'd rather type the password every time than keep it on disk.)

解决方案

With git 2.9 (June 2016), this (helper = ) will actually work!

See commit 2432137 (26 Feb 2016) by Jeff King (peff).
(Merged by Junio C Hamano -- gitster -- in commit 1b68962, 03 Apr 2016)

The credential.helper configuration variable is cumulative and there is no good way to override it from the command line.
As a special case, giving an empty string as its value now serves as the signal to clear the values specified in various files.

credential: let empty credential specs reset helper list

Since the credential.helper key is a multi-valued config list, there's no way to "unset" a helper once it's been set. So if your system /etc/gitconfig sets one, you can never avoid running it, but only add your own helpers on top.

Since an empty value for credential.helper is nonsensical (it would just try to run "git-credential-"), we can assume nobody is using it. Let's define it to reset the helper list, letting you override lower-priority instances which have come before.

这篇关于如何禁用单个存储库的git的凭证助手?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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