开始使用令牌后,Windows客户端中的git pull over ssh挂起

时间:2018-10-10 12:20:25

标签: git ssh

我正在使用Windows ssh本机服务器(RS4附带)。 我的客户是Windows和Linux。

我以前一直将ssh(Windows / Linux)一直拉到Windows计算机,没有问题。 今天,我开始在https上使用令牌,从那时起,我无法使用ssh进行git pull,该过程在Windows和Linux客户端中都将永远挂起。

本地git pull可以正常工作,其他git pull功能(例如config / remote / etc。)可以通过ssh正常工作。

我还尝试在ssh上运行python脚本,该脚本在远程计算机上执行git pull,但效果不佳,它也挂起了。

在远程任务管理器中,我看到许多git进程,例如:git-credential-manager.exe,git.exe,git-remote-https.exe-这意味着需要与这些程序之一进行交互,但它们是在后台运行,因为它们是通过ssh启动的。

如果我这样做:

git pull https://user:password@github.com/path/repo

它可以工作,但是我不想在我的代码中使用纯文本密码。 我如何解决这个问题?

谢谢。

1 个答案:

答案 0 :(得分:0)

发生此问题是由于ssh会话期间,git-credential-manager.exe(它是Windows的Git的一部分)在远程计算机的后台弹出。

要解决此问题,您应该通过卸载git-credential-manager来禁用它,或者在Git for Windows安装过程中不要首先安装git-credential-manager /运行以下git命令:

config --global --unset credential.helper

这将全局禁用凭据帮助器。 如果要将密码保存在.git-credential文件中(例如在Linux中),请运行:

git config credential.helper store

“。git-credential”文件将在您第一次输入密码时在您的主目录中创建。

SSH将不再挂起。