首页 > github permission denied(public key)

github permission denied(public key)

mac系统
使用ssh -T git@github.com命令时候是完全没有问题的

但是当使用 git clone *** 的时候就提示permission denied(public key)

id_rsa也是我新添加到github里面的


方案

1.首先确保这一步做完整了。(user.name user.email不变, “ ”里的要变)

$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"

注意 git config 命令的--global参数,用了这个参数,表示你这台机器上所有的Git 仓库都会使用这个配置,当然也可以对某个仓库指定不同的用户名和Email地址。

2.创建SSH Key,登陆GitHub,打开“Account settings”,“SSH Keys”页面,添加。
这里给链接。
远程仓库 SSH

3.还是不行,看下面。

git clone ssh://github.com/username/repository.git 

上面的用法格式错误。应该是下面的格式:

git clone ssh://git@github.com/username/repository.git

或者,

git clone git@github.com:username/repository.git

参考

Git教程英文链接


你应该添加id_rsa.pub内容到github
这个才是公钥

但是感觉还是其它原因造成的

【热门文章】
【热门文章】