You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行ssh命令时ssh-agent无法正常工作的问题求助

ssh-agent 未自动使用已加载密钥的问题

环境详情

$ ssh -V
OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f  31 Mar 2020
$ ssh-add -L
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE5FkZ3APf9VLQFHZQV9+JFsNSvY5u33uv5/EWGoQwl5 
$ curl https://github.com/impactaky.keys
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE5FkZ3APf9VLQFHZQV9+JFsNSvY5u33uv5/EWGoQwl5
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH+nGZTKYUTVOlcJR+OFBE1zDvv5DT2DAcxznTSzXdtr

问题表现

连接GitHub时,ssh未尝试使用ssh-agent中已加载的密钥,直接遍历本地~/.ssh目录下的密钥文件并要求输入密码:

$ ssh -T -vv git@github.com
OpenSSH_8.2p1 Ubuntu-4ubuntu0.5, OpenSSL 1.1.1f  31 Mar 2020
...
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/impactaky/.ssh/id_rsa
debug1: Trying private key: /home/impactaky/.ssh/id_dsa
debug1: Trying private key: /home/impactaky/.ssh/id_ecdsa
debug1: Trying private key: /home/impactaky/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/impactaky/.ssh/id_ed25519
Enter passphrase for key '/home/impactaky/.ssh/id_ed25519':

配置说明

我使用自定义Zsh脚本管理ssh-agent,包含密钥自动加载等相关设置。

求帮忙排查问题,感谢!


内容的提问来源于stack exchange,提问作者impactaky

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 19:52:39