我本地的git配置的多账号,切换的时候需要使用ssh-add ~/.ssh/id_rsa_name这个命令,今天运行的时候出现Could not open a connection to your authentication agent.
这时可以使用:ssh-agent bash 命令,然后再次使用ssh-add ~/.ssh/id_rsa_name这个命令就没问题了。
如下:
[root@localhost wakavS]# ssh-add ~/.ssh/id_rsa_Leen
Could not open a connection to your authentication agent.
[root@localhost wakavS]# ssh-agent bash
[root@localhost wakavS]# ssh-add ~/.ssh/id_rsa_Leen
Enter passphrase for /root/.ssh/id_rsa_Leen:
Identity added: /root/.ssh/id_rsa_lidong (/root/.ssh/id_rsa_Leen)
1
2
3
4
5
6
二、还有一种方式:
eval ssh-agent
这个我没有试!
Author:leedaning
————————————————
版权声明:本文为CSDN博主「leedaning」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/leedaning/article/details/49888335