windows - 尝试克隆 git repo 后 Win 控制台挂起

标签 windows git ssh putty

<分区>

我有一个要克隆的远程仓库。我已经设置了 pageant.exe 并添加了私钥。还添加了指向 plink.exe 的 GIT_SSH 变量。在克隆命令之后我得到这样的输出

The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
...
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n)

当键入 yn 时没有任何反应,控制台只是挂起,我必须使用 Ctrl+C 终止命令

为什么会发生这种情况以及如何解决?

最佳答案

经过几个小时的调查,我终于找到了解决方案。 putty 必须了解您要连接的主机,即主机必须是 known_host 到 putty。 Putty 将有关 know_hosts 的信息存储在 HKEY_CURRENT_USER\SoftWare\SimonTatham\PuTTY\SshHostKeys 注册表项。要强制 putty 将有关该主机的信息添加到注册表项,我们可以使用您的私钥通过 putty.exe 进行访问。第一次访问时,putty 会要求您将该主机添加到 known_hosts。之后 git clone 命令成功完成。

也许这对某些人有帮助,因为乍一看并不明显

关于windows - 尝试克隆 git repo 后 Win 控制台挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33690247/

相关文章:

c++ - 从内核模式执行用户模式可执行文件

c# - ASP.NET中的Token方法,接受curl中的每个HTTP方法

.net - 如何命名已部署的应用程序?

git - 如何使用 'git credential-osxkeychain store' 从命令行添加凭据?

git - git 如何处理移动到不同文件的 merge 代码?

windows - 如果不成功则暂停命令而不是自动关闭

git - 在 GitHub 上使用别人的 repo 作为 Git 子模块

git - 如何解决 RHEL 容器上的 "shell request failed on channel 0"?

ssh - 在 Ansible playbook 中调用 ssh-copy-id - 如何处理密码提示?

linux - ssh 忽略特殊字符