当默认的私钥不对的时候,一般会有类似报错:
git clone git@******
Cloning into ‘******’…
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
比较方便的解决方法如下:
目前发现的缺陷就是,缓存会随着电脑重启而失效,需要重新添加
1、使用ssh-add命令将对应的key加入到高速缓存中
ssh-add id_rsa_a
ssh-add id_rsa_b
2、可以查看已添加的私钥
ssh-add -l
3、再次执行git命令即可