git 中github clone "Permission denied (publickey). fatal: Could not read from remote repository."
来源:互联网 发布:我生也有涯而知也无涯 编辑:程序博客网 时间:2024/05/16 13:01
第一次使用然后,,出现上述问题
解决办法均来自互联网:
设置Git的user name和email
git config –global user.name “yourname”
git config –global user.email “youremail”
生成SSH密钥
查看是否已经有了ssh密钥:cd ~/.ssh
如果没有密钥则不会有此文件夹,有则备份删除
生存密钥:
ssh-keygen -t rsa -C “haiyan.xu.vip@gmail.com”
按3个回车,密码为空。
Your identification has been saved in /home/tekkub/.ssh/id_rsa.
Your public key has been saved in /home/tekkub/.ssh/id_rsa.pub.
The key fingerprint is:
………………
最后得到了两个文件:id_rsa和id_rsa.pub
添加密钥到ssh:ssh-add 文件名,需要之前输入密码.
在github上添加ssh密钥,这要添加的是“id_rsa.pub”里面的公钥。
打开https://github.com/,在设置中添加密钥
测试:ssh git@github.com
The authenticity of host ‘github.com (207.97.227.239)’ can’t be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘github.com,207.97.227.239′ (RSA) to the list of known hosts.
ERROR: Hi tekkub! You’ve successfully authenticated, but GitHub does not provide shell access
Connection to github.com closed.
解决办法:
1.ssh -v git@github.com
测试ssh连接是否成功,如LZ显示如下:
$ ssh -v git@github.com
OpenSSH_7.3p1, OpenSSL 1.0.2j 26 Sep 2016
[plain] view plain copy
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: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: 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).
- ssh-agent -s
[plain] view plain copy
$ 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;
- ssh-add ~/.ssh/id_rsa
[plain] view plain copy
$ ssh-add ~/.ssh/id_rsa
Could not open a connection to your authentication agent.
LZ这一步报错了,继续执行:eval ssh-agent -s
无错请忽略以下步骤
[plain] view plain copy
$ eval ssh-agent -s
Agent pid 24460
再次执行ssh-add ~/.ssh/id_rsa
[plain] view plain copy
$ 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
[plain] view plain copy
$ ssh -T git@github.com
Hi JsonJu! You’ve successfully authenticated, but GitHub does not provide shell access.
接下来就可以愉快的去clone github上优秀的项目了。
当采用第二种办法时遇到没有文件夹的时候,我们就应该采用第一种办法建立文件夹
- git 中github clone "Permission denied (publickey). fatal: Could not read from remote repository."
- github clone "Permission denied (publickey). fatal: Could not read from remote repository."
- 遇到从github git clone不下来,报Permission denied (publickey). fatal: Could not read from remote repository.
- Permission denied (publickey) fatal:Could not read from remote repository
- Permission denied (publickey). fatal: Could not read from remote repository.
- Permission denied (publickey).fatal: Could not read from remote repository.
- Permission denied (publickey). fatal: Could not read from remote repository
- github Permission denied (publickey). fatal: Could not read from remote repository.
- Github连接不上:Permission denied (publickey).fatal: Could not read from remote repository.
- git认证证书问题解决方案(github clone "Permission denied (publickey). fatal: Could not read from remote reposi)
- git: Permission denied(publickey). fatal:Could not read from remote repository.
- 【git】Permission denied (publickey). fatal: Could not read from remote repository.解决方案
- git Permission denied (publickey). fatal: Could not read from remote repository. Please make sure y
- git Permission denied (publickey). fatal: Could not read from remote repository.
- Permission denied (publickey). fatal: Could not read from remote repository. Pleasemake sure you h
- git push -u origin master 出错 \Permission denied (publickey). fatal: Could not read from remote repo
- 【git使用】Permission denied (publickey). fatal: Could not read from remote respository.解决办法
- 【git使用】Permission denied (publickey). fatal: Could not read from remote respository.解决办法
- Android基础:最易懂的Activity启动模式详解
- linux中nginx的安装
- Java的多线程机制系列:(四)不得不提的volatile及指令重排序(happen-before)
- bzoj3224 Tyvj 1728 普通平衡树
- Java日志技术汇总(log4j , Commons-logging,.....)
- git 中github clone "Permission denied (publickey). fatal: Could not read from remote repository."
- PHP慢脚本日志和Mysql的慢查询日志
- tomcat下静态页面中文乱码
- C6-2 字符串的回文子序列个数
- XSL中调用模板的时候传递可变参数
- Laravel - CSRF token禁用方法
- Parasoft C++test使用教程:桩函数
- 时间格式化函数
- 网页数据抓取之当当数据