Windows下使用ssh-add报错 Error connecting to agent: No such file or directory
环境信息
问题
使用ssh-add时报错
PS D:\code> ssh-add -l
Error connecting to agent: No such file or directory
处理步骤
- 检查ssh-agent服务是否启动成功
PS D:\code> get-service ssh*
Status Name DisplayName
------ ---- -----------
Stopped ssh-agent OpenSSH Authentication Agent
- 发现ssh-agent服务状态为 stopped,启动服务
PS D:\code> Set-Service -Name ssh-agent -StartupType Manual
PS D:\code> Start-Service ssh-agent
- 执行ssh-add命令检查是否成功
PS D:\code> ssh-add -l
2048 SHA256:Dw8iD5trSzInnsmmDpaXBusdfL2K3wM3b+GMulKNHbAU C:\Users\Administrator\.ssh\xxx-pc (RSA)
2048 SHA256:Mb4qKSueS8bqNALm3423eD98KdTIuEwnLvfVWTNPCusg C:\Users\Administrator\.ssh\yyy (RSA)
2048 SHA256:nyLi89QHTYFMr97sM0cG9I6sBfA82GpR9Os2WF0HlwA C:\Users\Administrator\.ssh\id_rsa (RSA)
- 问题解决