问题描述
git 添加秘钥时出现上述提示
xxxx@DESKTOP-R2MBPRO MINGW64 ~/.ssh
$ ssh-add /c/Users/xxxx/.ssh/id_rsa
Could not open a connection to your authentication agent.
解决方式
- 在执行前先执行一下
ssh-agent bash
标注
ssh-agent bash是一个命令组合,用于启动ssh-agent程序并挂载到当前 shell 环境
- 发现后续执行成功
xxxx@DESKTOP-R2MBPRO MINGW64 ~/.ssh
$ ssh-add ./id_rsa
Could not open a connection to your authentication agent.
xxxx@DESKTOP-R2MBPRO MINGW64 ~/.ssh
$ ssh-agent bash
xxxx@DESKTOP-R2MBPRO MINGW64 ~/.ssh
$ ssh-add ./id_rsa
Identity added: ./id_rsa (xxxx@foxmail.com)