VSCode 不断询问 SSH 密钥的密码 [英] VSCode Keep asking for passphrase of SSH key

查看:70
本文介绍了VSCode 不断询问 SSH 密钥的密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近升级了我的 VSCode 版本 1.10.2.当我将密码放在我的私人 SSH 密钥上时,即使我多次输入它,它也开始频繁地要求它,这非常烦人.无论如何我可以摆脱它吗?谢谢.

I have recently upgrade my VSCode version 1.10.2. As I put passphrase on my private SSH key, it started to ask for it frequently even when I entered it multiple times, which is very annoying. Is there anyway I can get rid of it? Thanks.

推荐答案

,您可以避免此提示,而无需删除密码.

Yes, you can avoid this prompt, without removing the passphrase.

这样做通常相当简单并且依赖于 ssh-agent 程序.首先,在启动 VSCode 之前,在 bash shell 提示符下,运行:

To do so is usually fairly simple and relies on the ssh-agent program. First, before starting VSCode, at a bash shell prompt, run:

$ eval `ssh-agent`

这将在后台启动一个 ssh-agent 进程,该进程将在其内存中记住解密的私钥.eval 的原因是 ssh-agent 打印了两个需要添加到 shell 的环境变量设置.(您也可以正常运行它,然后手动将其输出复制并粘贴回 shell.)

This will start an ssh-agent process in the background that will remember the decrypted private key in its memory. The reason for eval is ssh-agent prints two environment variable settings that need to be added to the shell. (You can also just run it normally, then manually copy and paste its output back into the shell.)

接下来,运行:

$ ssh-add

这将提示您输入密码,之后 ssh-agent 将为需要它的任何其他进程提供私钥服务.

This will prompt you for your passphrase, after which ssh-agent will provide private key services to any other process that needs it.

最后,从您运行第一个命令的同一个 shell 启动 VSCode:

Finally, start VSCode from the same shell you ran the first command:

$ code

这样 VSCode 将继承从 ssh-agent 获取关键服务所需的环境变量,因此只要 ssh-agent> 进程继续运行.

This way VSCode will inherit the environment variables it needs to get key services from ssh-agent, and therefore will not prompt for your passphrase so long as the ssh-agent process continues running.

不幸的是,尽管它非常有用,但是很难找到关于 ssh-agent 的好的(简洁易读的)文档.但这里有一些可能性:

Unfortunately, despite it being so useful, good (concise, readable) documentation on ssh-agent is hard to find. But here are some possibilities:

  • 手册页是典型的手册页,重细节,轻示例.

  • The man page is, as is typical for man pages, heavy on detail and light on examples.

文章http://rabexc.org/posts/using-ssh-agent很不错,涵盖了一些更高级的情况,尤其是代理转发.

The article http://rabexc.org/posts/using-ssh-agent is pretty good, and it covers some more advanced situations, especially agent forwarding.

Stack Exchange 问题,ssh 的目的是什么-代理?"也不错.

这篇关于VSCode 不断询问 SSH 密钥的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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