GitHub 凭证助手与 wincred 凭证助手冲突

标签 git github credentials

我必须能够在两种情况下执行 Git 命令:

  1. 在 posh-Git(和 GitHub for Windows UI)中
  2. 通过在 Windows 资源管理器中双击批处理文件(我创建了一系列批处理文件来简化非技术项目参与者的 Git 使用)

除了推/pull 操作外,一切都完美无缺,那里存在凭据帮助程序问题。使用默认的 GitHub 设置,它在 etc/.gitconfig 中使用 helper = !github –credentials,远程操作适用于上下文 1 但不适用于上下文 2(它要求提供凭据每次)。如果我将 helper = wincred 添加到 user/.gitconfig,那么上下文 1 工作正常,上下文 2 工作正常,尽管它首先提示:

github --credentials get: github: command not found
github --credentials store: github: command not found

(我假设它提示是因为它试图使用 GitHub 助手但不能在上下文 2 中使用)但随后继续执行推送:

Counting objects: 11, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (5/5), 467 bytes | 0 bytes/s, done.
Total 5 (delta 1), reused 0 (delta 0)
...

我可以忍受提示,但问题是每当 GitHub for Windows 启动时,它都会从 user/.gitconfig 中删除 helper = wincred

问题是:我可以吗

  1. 获取上下文 1 以使用 wincred 助手
  2. 让 GitHub 助手在上下文 2 中工作
  3. 防止 GitHub for Windows 删除 wincred(虽然这种行为可能是正确的,因为我认为你不应该有两个凭证助手)
  4. 安装一个可以在两种情况下使用的不同凭证助手

最佳答案

我遇到了类似的问题并联系了 GitHub 支持并得到了这样的回复:

What you're hitting is a configuration sanitizer which GitHub for Windows runs on startup. We've seen significant issues in the past with other Git clients adding invalid/bad configuration values into this file and giving users a bad experience - so we had to take steps to mitigate these issues.

This is opt-in, and you can bypass this by running the following command:

git config --global ghfw.disableverification true

这解决了我的问题

关于GitHub 凭证助手与 wincred 凭证助手冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26681770/

相关文章:

git-svn:如何通过 git 创建一个新的 svn 分支?

git: 无法创建上游分支

java - 检测到新的 GitHub 存储库时创建 Jenkins 作业

git - 将一个 git 存储库的问题链接到另一个存储库的提交

ios - 我可以在 IOS Swift 应用程序中将用户名和密码保存在单例中吗?

git - git fetch 的常见用例是什么?

git - 提交代码时多久评论一次?

windows - 存储跨域 Web 服务访问凭据的最佳实践?

ruby-on-rails - 公共(public)铁路应用程序中的敏感数据存储在哪里?

git 工作流 : maintaining a history of functional commits