小编mak*_*kos的帖子

适用于 Linux Ubuntu 的 Windows 子系统:ssh-agent 正在运行,但 ssh-add 抱怨“无法打开与身份验证代理的连接”

当我离开桌面时,我在笔记本电脑上使用带有 Ubuntu 的 WSL 在 Linux 上进行开发(使用本机 Linux,我不会遇到任何此类问题)。我有私人 git 存储库设置,我使用 ssh 连接到它。我配置了 ssh(在 中.ssh/config),并且我的 VPS、GitHub、其他 VPS 用户帐户等有多个密钥,因此我ssh-add在桌面上使用它们来管理它们。但在我的笔记本电脑上,在 WSL 中,当我尝试连接到我的 VPS 时,ssh 会要求输入密钥的密码。当我尝试这样做时,ssh-add .ssh/mykey出现错误:

$ ssh-add .ssh/mykey
Could not open a connection to your authentication agent.
Run Code Online (Sandbox Code Playgroud)

ssh-agent正在运行:

$ ps -e | grep ssh
4455 ?        00:00:00 ssh-agent
5517 ?        00:00:00 sshd
6164 pts/0    00:00:00 ssh
Run Code Online (Sandbox Code Playgroud)

我不明白为什么会有问题。如果我杀死当前正在运行的ssh-agent并再次启动它(使用eval $(ssh-agent -s))它工作正常。

linux ssh git windows-subsystem-for-linux

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

git ×1

linux ×1

ssh ×1

windows-subsystem-for-linux ×1