一. 发现问题:

  使用 git clone 命令时出现Permission denied (public key) 。

二. 解决问题:

  1、首先尝试重新添加以前生成的key,添加多次,仍然不起作用。

  2、使用命令 ssh -v git@github.com测试,最后几行结果如下:   

    debug1: Authentications that can continue: publickey
    debug1: Next authentication method: publickey
    debug1: Trying private key: /home/gr/.ssh/id_rsa
    debug1: Trying private key: /home/gr/.ssh/id_dsa
    debug1: Trying private key: /home/gr/.ssh/id_ecdsa
    debug1: No more authentication methods to try.
    Permission denied (publickey).

  3、分析:尝试了3个private key,但都没有成功,最后是导致Permission denied.

  4、查看我的密钥, ls ~/.ssh/ :

    bajie  bajie.pub  known_hosts    

  5、发现我的id_rsa文件我命令为bajie, 所以根本没有使用它。同时可以使用如下命令查看密钥列表:

    ssh-add -l

  6、上面命令的密钥列表为空,所以要添加我的密钥,使用命令:

    gr@grpc:~/workspace/git/home$ ssh-add ~/.ssh/bajie

    Enter passphrase for /home/gr/.ssh/bajie:
    Identity added: /home/gr/.ssh/bajie (/home/gr/.ssh/bajie)

  7、再次查看,如下,添加成功:

    gr@grpc:~/workspace/git/home$ ssh-add -l

    2048 63:c5:d8:6c:a0:0c:a8:9c:26:d8:f8:95:de:29:04:eb /home/gr/.ssh/bajie (RSA)

  8、再使用ssh -v git@github.com测试连接,可以看到验证通过:

    debug1: Authentications that can continue: publickey
    debug1: Next authentication method: publickey
    debug1: Offering RSA public key: /home/gr/.ssh/bajie
    debug1: Server accepts key: pkalg ssh-rsa blen 279
    debug1: Authentication succeeded (publickey).
    Authenticated to github.com ([192.30.252.129]:22).

  9、最后git clone项目成功。

  欢迎访问我的个人主页: www.forgerui.tk

Github 访问时出现Permission denied (public key)的更多相关文章

  1. Git permission denied(public key) 解决方法

    1. 在Linux上: # ssh-keygen       ##一定用 id_rsa.pub # cat /root/.ssh/id_rsa.pub 2. copy 整个文件内容到剪切板 3. 打开 ...

  2. github提交代码时,报permission denied publickey

    在像github提交代码时,报permission denied publickey. 查找了一下,可能是因为github的key失效了. 按照以下步骤,重新生成key. ssh-keygen 一路默 ...

  3. mac 下终端访问文件出现“Permission Denied”解决方案

    mac 下终端访问文件出现“Permission Denied”解决方案: 一个文件有3种权限,读.写.可执行,你这个文件没有可执行权限,需要加上可执行权限. 1. 终端下先 cd到该文件的目录下 2 ...

  4. 关于GitHub推送时发生Permission denied (publickey)的问题

    今天在学习廖雪峰老师官网的git教程“添加远程库”时发现总是推送失败,下边提示“Permission denied (publickey) 这个问题” 传送门:https://www.liaoxuef ...

  5. 关于使用Hadoop MR的Eclipse插件开发时遇到Permission denied问题的解决办法【转】

    搭建了一个Hadoop的环境,Hadoop集群环境部署在几个Linux服务器上,现在想使用windows上的Java客户端来操作集群中的HDFS文件,但是在客户端运行时出现了如下的认证错误,被折磨了几 ...

  6. git 时 出现 Permission denied (publickey).

    https://blog.csdn.net/awp0011/article/details/73368481 第一次使用github.com在本地 执行 git clone git@github.co ...

  7. Linux 客户端访问 NFS报Permission Denied错误

    在Linux服务器上访问NFS共享目录时,报错:Permission denied. 如下截图所示: 因为这个NFS是系统管理员配置的,我又不了解具体情况,而系统管理员休假中,联系不上.那么我只能先多 ...

  8. 使用CocoaPods时遇到 Permission denied 问题

    报错: Setting up CocoaPods master repo [!] /usr/bin/git clone fatal: could not create work tree dir 'm ...

  9. GITHUB 提交错误 Error: Permission denied (publickey) 解决

    1.  在开发机上生成自己的密钥 ssh-keygen -b 1024 -t rsa -b 指密钥对长度  -t 指加密方式 Enter file in which to save the key ( ...

随机推荐

  1. WinForm特效:拦截窗体上各个部位的点击

    windows窗体的标题栏无法直接通过一些默认的事件来控制,需要了解和WM_NCHITTEST相关的windows消息. 以下示例演示了最简单的效果片断: 他会把客户区和标题栏的效果互换,比如无法按住 ...

  2. 【JavaScript】关于js的一些理解

    嵌套函数即作用域链:嵌套函数即闭包 函数表达式即延迟执行 匿名函数----------->实现块级作用域 call会切换到调用的对象参数环境.

  3. Gtest源码剖析:1.实现一个超级简单的测试框架xtest

    下面的代码模仿gtest实现,主要说明了以下两点: ASSERT_* 和 EXPECT_*系列断言的原理和作用. gtest是怎样通过宏自动注册测试代码让其自动运行的. #include <io ...

  4. oc-25-id类型,

    /** id:万能指针 能够指向任何OC对象. id = NSObject *, id cat = [Cat new]; [cat jump]; NSObject:是所有类的父类,基类.可以指向任何O ...

  5. THD 变量存入threads中

    http://blog.csdn.net/gapaul/article/details/12047497 http://ourmysql.com/archives/930

  6. 21 Free SEO Tools For Bloggers--reference

    http://dizyne.net/21-free-seo-tools-for-bloggers/ What do you think is important in a website? Yes, ...

  7. 3.1html学习之列表

    一.含义: ul:unorder list ol:order list li:list item dl:definition list dt:definition term dd:definition ...

  8. 根据当前IP获取当时所在信息

    现在很多系统,都要在登录时候,确定当前用户所在的位置.这里记录一个C#使用Http的方式获取当前IP所在的位置信息.主要使用的api是新浪的接口. public partial class sina ...

  9. maven安装仓库中不存在的jar包

    这里以ojdbc6.jar作为案例 首先我的ojdbc6.jar放在D盘的根目录D:\ojdbc6.jar 然后我们打开cmd命令窗口,运行命令:mvn install:install-file -D ...

  10. 使用Spring Security实现权限管理

    使用Spring Security实现权限管理 1.技术目标 了解并创建Security框架所需数据表 为项目添加Spring Security框架 掌握Security框架配置 应用Security ...