解决方法:首先打开命令行 验证下使用ssh 能否正确连接到 github
ssh -T [email protected]
You may see a warning like this:
> The authenticity of host 'github.com (IP ADDRESS)' can't be established.
> RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
> Are you sure you want to continue connecting (yes/no)?
选择yes
> Hi username! You've successfully authenticated, but GitHub does not
> provide shell access.
看到如上说明ssh连接没有问题
idea中 修改远程仓库地址 为ssh的地址
之前远程仓库地址为 https的 https://github.com/passliang/pattern.git
修改为 ssh的地址 [email protected]:passliang/pattern.git
修改好再次尝试推送 OK
正文结束
ssh配置问题
删掉旧的 个人目录下 .ssh文件
重新生成
$ ssh-keygen -t rsa -C "[email protected]"
最后将生成的.ssh文件夹中的 id_rsa.pub
将其中所有内容添加到 github上
重新尝试 上述 命令ssh连接 GitHub
ssh -T [email protected]
还是提示 permission denied 说明认证还是不成功
在检查下是否有代理
执行下面两条 Git全局配置不设置HTTPS 和HTTP代理
git config --global --unset http.proxy
git config --global --unset https.proxy