git克隆出错 github clone Permission denied (publickey) fatal Could not read from remote repo

原文网址:http://blog.csdn.net/feeling450/article/details/53067563

github clone "Permission denied (publickey). fatal: Could not read from remote repository."

LZ用git不久,第一次从github clone项目遇见一下问题

$ git clone [email protected]:xiaolongzuo/niubi-job.gitCloning into ‘niubi-job‘...Permission denied (publickey).fatal: Could not read from remote repository.

解决办法:

1.ssh -v [email protected]

测试ssh连接是否成功,如LZ显示如下:

$ ssh -v [email protected]

OpenSSH_7.3p1, OpenSSL 1.0.2j 26 Sep 2016

debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [192.30.253.113] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Administrator/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/Administrator/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/Administrator/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/Administrator/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/Administrator/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/Administrator/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/Administrator/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/Administrator/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.3
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
debug1: Authenticating to github.com:22 as ‘git‘
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug1: Host ‘github.com‘ is known and matches the RSA host key.
debug1: Found key in /c/Users/Administrator/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /c/Users/Administrator/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /c/Users/Administrator/.ssh/id_dsa
debug1: Trying private key: /c/Users/Administrator/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/Administrator/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

2. ssh-agent -s

$ ssh-agent -s
SSH_AUTH_SOCK=/tmp/ssh-GTpABX1a05qH/agent.404; export SSH_AUTH_SOCK;
SSH_AGENT_PID=13144; export SSH_AGENT_PID;
echo Agent pid 13144;

3. ssh-add ~/.ssh/id_rsa

$ ssh-add ~/.ssh/id_rsa
Could not open a connection to your authentication agent.

LZ这一步报错了,继续执行:eval `ssh-agent -s`

无错请忽略以下步骤

$ eval `ssh-agent -s`
Agent pid 24460

再次执行ssh-add ~/.ssh/id_rsa

$ ssh-add ~/.ssh/id_rsa
Identity added: /c/Users/Administrator/.ssh/id_rsa (/c/Users/Administrator/.ssh/id_rsa)

4.将客户端生成的key添加到github账户

首先使用 clip < ~/.ssh/id_rsa.pub  或者文本编辑拷贝id_rsa.pub文本内容

到github右上角账户管理-Setting下面找到左侧“SSH and
GPG keys”菜单,接着点击“Add SSH key”,在"title"栏输入一个自己喜欢的标题,“key”栏中粘贴刚刚复制的公钥内容,最后点击“Add key”按钮。

5.最后一步,验证key

$ ssh -T [email protected]
Hi JsonJu! You‘ve successfully authenticated, but GitHub does not provide shell  access.

接下来就可以愉快的去clone github上优秀的项目了。

原文地址:https://www.cnblogs.com/myworld2018/p/9178922.html

时间: 2024-11-05 22:50:24

git克隆出错 github clone Permission denied (publickey) fatal Could not read from remote repo的相关文章

【git基础】Permission denied (publickey). fatal: Could not read from remote repository

运行以下git命令的时候出现错误 git push -u origin master error The authenticity of host 'github.com (13.250.177.223)' can't be established. RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8. Are you sure you want to continue connecting (yes

Permission denied (publickey) fatal:Could not read from remote repository

安装了TortoiseGit之后,Eclipse能够克隆提交操作,但是通过文件夹的方式clone却总是报Permission denied (publickey)错误 ,网上找各种资料都没有解决. 报错信息如下图: 后面发现TortoiseGit Git clone时 "Load Putty Key"为灰色,并且里面的内容也是空的.(当时load Putty Key复选框也是灰色的) 也就怀疑可能是这个原因导致 Permission denied (publickey)错误,通过网上查

Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights

第一次提交遇到这样的情况,怎么回事呢,我在github上提交了ssh key 的啊. 排查先看看能不能解析, 1.先 ping https://github.com 把ip添加到 host :    sudo vi /etc/hosts  (添加下面第三行) 127.0.0.1 localhost localhost.localdomain VM-0-6-ubuntu 127.0.1.1 TENCENT 192.30.255.113 github.com # 添加ip # The followi

SSH方式登录github出现Permission denied (publickey)

今天在公司上传了代码,回到家pull,结果竟然出现了“Permission denied (publickey)“这种东西.第一反应是key不对,可是上次明明用key登录过,不可能不对啊,难道是文件被删除或覆盖?赶紧ls .ssh瞅一眼,发现上次生成的git.git.pub文件好好的在那呢.再想想,我也没动过github上的key设置啊,在公司都是https方式push的呢.确认不是key的设置问题,在http://henzil.easymorse.com/?p=508找到了解决方案. 下面记录

github出现Permission denied (publickey) 的解决方法

今天git上传的时候出现了如下错误: Permission denied (publickey).fatal: The remote end hung up unexpectedly 原因分析: ssh key 过期,重新创建即可. 步骤如下: 1.ssh-keygen (注意短横线前后都没有空格) 2.Enter, Enter, Enter... 3.~/.ssh 4.vim id_rsa.pub 5.github页面中,setting->SSH Keys->Add SSH Key 6.ti

git连接报错:Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)

在Linux上已经安装过git了,本机(windows)想连接,通过git bash敲了下clone命令提示没权限: $ git clone git@111.11.111.11:code.git Cloning into 'code'... The authenticity of host '111.11.111.11 (111.11.111.11)' can't be established. ECDSA key fingerprint is SHA256:7jmL7Nrr9zJ7psJd3Z

ubuntu 下使用git/github [Error: Permission denied (publickey) ]

1.背景 之前因为误删了文件,导致程序和软件都被删除,损失是心疼的,里面有这好几个月的练习代码,一步一步走来的,就这样没了. 为了避免重蹈覆辙,于是准备使用git版本控制.在此记录一下,在配置git时候遇到的一些小问题. 2.准备工作 本机系统:ubuntu 14.04 整个配置过程是在廖雪峰的官方网站的指导下进行,因为其讲解较为详细,语言通俗易通, 按照流程配置基本没有问题.但因为环境和操作的不同,会出现问题也是在所难免的. 3.遇到的问题 在git创建仓库–>初始化–>add添加到暂存区–

$ ssh -T -v [email&#160;protected]_在本地用ssh连接github出错[email&#160;protected]: Permission denied (publickey).

$ ssh -T -v [email protected]报错: debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Trying private key: /Users/eveline/.ssh/id_rsa debug1: Trying private key: /Users/eveline/.ssh/id_dsa debug1:

windows下github 出现Permission denied (publickey).解决方法

今天在学习github的时候遇到了一些问题,然后爬了一会,找到了解决方法记录下来,以防忘记,当然能帮助别人最好啦! github教科书传送门:http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000 再学习到"添加远程仓库"的时候遇到了 Permission denied (publickey) 这个问题, 总结来说以前的步骤如下所示: 1.git config --global