【转载】解决方案:[email protected]出现Permission denied (publickey)

遇到的问题

今天心血来潮,想将intellij上的项目代码放到GitHub上管理。

在进行添加远程库的时候,出现了:[email protected]出现Permission denied (publickey)

原因是 ./ssh目录默认在C:\Users\VULCAN\.ssh,而我在输入 ssh-keygen 命令的时候,是在intellij的项目位置。结果是,去查看.ssh目录,发现里面没有id_rsa和id_rsa.pub文件。

解决方案如下:

在在输入 ssh-keygen 命令时的位置找到id_rsa和id_rsa.pub文件,再复制到./ssh下。

 

再用ssh -T -v [email protected]这个命令查看下是否连接成功,成功了吗?并没有。因为我并没有在GitHub网站上添加我的SSH。

接下来,进行以下操作,用记事本打开 id_rsa.pub (注意,不是id_rsa,id_rsa是私钥,id_rsa.pub 是公钥),选中id_rsa.pub的全部内容,复制。

登录GitHub,在My Profile的SSH里设置,添加。

再次使用ssh -T -v [email protected]这个命令查看下是否连接成功;

成功提示如下: You've successfully authenticated, but GitHub does not provide shell access.

其它:

如果过程中出现:Could not open a connection to your authentication agent.

解决方案如下:

eval `ssh-agent -s`

ssh-add ~/.ssh/id_rsa

复制这两行代码,运行即可(注意,要在./ssh的环境下)。

猜你喜欢

转载自www.cnblogs.com/appium/p/10030959.html
今日推荐