【问题标题】:Using git in windows over sshd - stuck in push通过 sshd 在 Windows 中使用 git - 卡在推送中
【发布时间】:2020-04-22 14:55:08
【问题描述】:

在我的环境中,我无法登录到 Windows GUI,但我必须使用 sshd 从 Windows Server 2019 获取控制台 (cmd.exe)。Git 已安装,但一旦我尝试执行 git推,我遇到一个问题:

通常,在 Windows 的 CMD 控制台中,会弹出一个带有凭据管理器的窗口,这不适用于这个用例,我实际上是通过 putty “ssh-ed”到 Windows 服务器。好像git卡住了,明显是想开个窗口。

如何关闭此行为,并使 Windows 上的 git 更“unix-ish”,以便像在 Linux 环境中一样,用户名/密码提示出现在控制台上?

【问题讨论】:

标签: windows git sshd


【解决方案1】:

尝试disable the credential helper(在您的 SSH 会话中)

git config credential.helper=

这将允许您测试 Git 是否在命令行上询问凭据,而不是打开一个弹出窗口。
请注意,这仅适用于您正在克隆 HTTPS URL。

备选方案:

cd path/to/repo
git config --system --unset credential.helper
git config --global --unset credential.helper
git config --unset credential.helper

【讨论】:

  • 抛出错误:git config credential.helper= git config credential.helper="" error: invalid key: credential.helper=
  • @Mandragor 在您通过 ssh 连接到的服务器上,您使用的是什么版本的 Git?
  • git --version git 版本 2.24.1.windows.2
  • @Mandragor 好的。然后只需删除该设置(我已经编辑了答案),进行测试。
  • 您的替代选项“git config --system --unset credential.helper”至少使它在控制台上工作,但我现在很困惑,因为它不再卡住了,而且不要求我的凭据,它只是工作......
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-03-16
  • 1970-01-01
  • 2013-07-22
  • 2023-03-04
  • 1970-01-01
  • 2021-06-18
  • 1970-01-01
相关资源
最近更新 更多