一. 发现问题:

  使用 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. Codeforces Round #310 (Div. 1) B. Case of Fugitive set

    B. Case of Fugitive Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/555/p ...

  2. Codeforces Beta Round #75 (Div. 1 Only) B. Queue 线段树+二分

    B. Queue Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 codeforces.com/problemset/problem/91/B Descrip ...

  3. 识货的拿走:Android游戏框架解读之总体结构

    Android游戏开发的框架图无偿奉上.

  4. 深入剖析 HTML5

    作为新一代的 HTML 标准,HTML5 不仅强化了 Web 网页的表现性能,还追加了本地数据库等 Web 应用的功能.虽然 HTML5 标准仍处于完善之中.然而,大部分新版本的浏览器已经能够支持某些 ...

  5. Java和C++中多态的实现方式

    多态是面向对象的最主要的特性之一,是一种方法的动态绑定,实现运行时的类型决定对象的行为.多态的表现形式是父类指针或引用指向子类对象,在这个指针上调用的方法使用子类的实现版本.多态是IOC.模板模式实现 ...

  6. HDOJ 1914 The Stable Marriage Problem

    rt 稳定婚姻匹配问题 The Stable Marriage Problem Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 6553 ...

  7. C++ SFINAE

    1. 什么是SFINAE 在C++中有很多的编程技巧(Trick), SFINAE就是其中一种, 他的全义可以翻译为”匹配失败并不是一个错误(Substitution failure is not a ...

  8. C++检测一个文件是否存在

    ifstream::is_open - C++ Reference http://www.cplusplus.com/reference/fstream/ifstream/is_open/ // if ...

  9. JavaScript目录

    1. 如何快速检查js语法学习Javascript 2. 如何快速掌握CSS(各种CSS工具)

  10. Tomcat7启动报Error listenerStart错误--转载

    原文地址:http://www.cnblogs.com/nayitian/p/3439336.html 问题 Tomcat7在启动时报错,详细信息如下: 十一月 23, 2013 7:21:58 下午 ...