遇到的问题

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

在进行添加远程库的时候,出现了:git@github.com出现Permission denied (publickey)

【转载】解决方案:git@github.com出现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下。

【转载】解决方案:git@github.com出现Permission denied (publickey) 

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

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

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

【转载】解决方案:git@github.com出现Permission denied (publickey)

 

再次使用ssh -T -v git@github.com这个命令查看下是否连接成功;

成功提示如下: 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的环境下)。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-03-06
  • 2021-08-24
  • 2022-12-23
  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
猜你喜欢
  • 2021-12-08
  • 2021-08-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案