我需要添加多个 ssh 密钥,所以我需要执行 ssh-add
但我得到错误 Could not open a connection to your authentication agent
我阅读了很多帖子,例如无法打开与您的身份验证代理的连接和https://superuser.com/questions/901568/ssh-agent-could-not-open-connection
我已经启动了 ssh-agent
eval ($ssh-agent -s)
Run Code Online (Sandbox Code Playgroud)
输出类似于:Agent pid 13524
但仍然收到此错误:
$ ssh-add ~/.ssh/id_rsa
Could not open a connection to your authentication agent.
Run Code Online (Sandbox Code Playgroud)
我也设置
git config --global url."https://".insteadOf git://
Run Code Online (Sandbox Code Playgroud)
我回显一些变量并得到这个:
echo $SSH_AGENT_PID
12340
echo $SSH_AUTH_SOCK
/tmp/ssh-ZbRZr10908/agent.10908
Run Code Online (Sandbox Code Playgroud)
PS:我使用的是Windows 7和公司下的网络。
你把代理的开始弄错了。它应该是:
eval $(ssh-agent -s)
Run Code Online (Sandbox Code Playgroud)
但是,如果这无济于事,无论如何您都可以通过尝试编写env变量来解决问题:
echo $SSH_AGENT_PID
echo $SSH_AUTH_SOCK
Run Code Online (Sandbox Code Playgroud)
并确保套接字(来自第二个的路径echo)存在并具有合理的 ACL。还要检查代理本身是否由PID.
我看到您正在使用 Windows,因此路径可能存在问题。幸运的是,ssh-agent支持-a带有 UNIX 域套接字路径或要绑定的地址的参数。你应该试试:
ssh-agent -a ./agent_socket
Run Code Online (Sandbox Code Playgroud)
或者
ssh-agent -a 127.0.0.1:9999
Run Code Online (Sandbox Code Playgroud)
即使在 Windows 上也应该工作。
| 归档时间: |
|
| 查看次数: |
13477 次 |
| 最近记录: |