【git-错误:ssh-add -K ~/.ssh/id_rsa Could not open a connection to your authentication agent.】

本文转载自:错误:ssh-add -K ~/.ssh/id_rsa Could not open a connection to your authentication agent.

解决方法:

第一步:检查已有的SSH keys

$ ls -al ~/.ssh

第二步:生成新的SSH key

$ ssh-keygen -t rsa -C "youremail@example.com"

然后将这个新的key添加到ssh-agent中:

$ ssh-agent -s
$ ssh-add ~/.ssh/id_rsa

如果ssh-add出错,执行ssh-agent bash,再次回到ssh-add命令。

第三步:将SSH key添加到你的GitHub账户

github的账户页的右上角,点击Setting—>SSH keys—>Add SSH key,在title栏输入一个自己喜欢的标题,key栏中粘贴id_rsa.pub的公钥内容,最后点击Add key按钮。
第四步:检查SSH key是否成功设置

$ ssh -T git@github.com

如果得到下面的结果,说明你的设置是成功的!
Hi username! You’ve successfully authenticated, but GitHub does not

参考:
(诊断)为GitHub添加SSH key时出现“Could not open a connection to your authentication agent”错误的应对方案。
执行ssh-add时出现Could not open a connection to your authentication agent

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值