今天准备学习一下RxJava的时候,git clone的时候遇到如下的问题:
darcy@darcy-pc:~/IdeaProjects$ git clone git@github.com:ReactiveX/RxJava.git
正克隆到 'RxJava'...
The authenticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
# darcy @ darcy-pc in /etc [15:00:38] C:128
$ sudo git clone git@github.com:ReactiveX/RxJava.git
[sudo] darcy 的密码:
正克隆到 'RxJava'...
The authenticity of host 'github.com (192.30.253.112)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
然后又把.ssh删除了重新使用ssh-keygen生成了一遍,公钥添加到github仍然有问题,如下:
# darcy @ darcy-pc in /etc [15:01:09] C:128
$ ssh git@github.com
sign_and_send_pubkey: signing failed: agent refused operation
Permission denied (publickey).
然后查看了一下,参考了解决方案,如下:
首先
清除所有的key-pair
ssh-add -D
rm -r ~/.ssh
删除你在github中的public-key
# darcy @ darcy-pc in ~ [15:03:29]
$ ssh-add -D
All identities removed.
# darcy @ darcy-pc in ~ [15:03:47]
$ rm -rf ~/.ssh*
然后重新生成密钥:
# darcy @ darcy-pc in ~ [15:04:11]
$ ssh-keygen -t rsa -C "YourGithubAccount@gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/darcy/.ssh/id_rsa):
Created directory '/home/darcy/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/darcy/.ssh/id_rsa.
Your public key has been saved in /home/darcy/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxx@gmail.com
The key's randomart image is:
+---[RSA 2048]----+
xxxxxxx
xxxxx
+----[SHA256]-----+
修改一下.ssh目录的权限,把公钥复制到自己的github帐号的SSH密钥那里去;
# darcy @ darcy-pc in ~ [15:06:11] C:1
$ chmod 744 .ssh
测试连通性,还特么不行。
# darcy @ darcy-pc in ~/.ssh [15:07:45]
$ ssh -T git@github.com
The authenticity of host 'github.com (192.30.253.112)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.112' (RSA) to the list of known hosts.
sign_and_send_pubkey: signing failed: agent refused operation
Permission denied (publickey).
ok,往下,看到github的help;
# darcy @ darcy-pc in ~/.ssh [15:09:36] C:255
$ ssh -vT git@github.com
OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
xxxxxx
xxxxxx
debug1: Trying private key: /home/darcy/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
# darcy @ darcy-pc in ~/.ssh [15:11:17] C:255
$ eval "$(ssh-agent -s)"
Agent pid 14319
官方说说明如下:
You should be able to fix this error by loading your keys into your SSH agent with ssh-add
# darcy @ darcy-pc in ~/.ssh [15:12:45]
$ ssh-add
Identity added: /home/darcy/.ssh/id_rsa (/home/darcy/.ssh/id_rsa)
再次测试,ok.
# darcy @ darcy-pc in ~/.ssh [15:13:04]
$ ssh git@github.com
PTY allocation request failed on channel 0
Hi XXX! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
去down RxJava
$ git clone git@github.com:ReactiveX/RxJava.git
正克隆到 'RxJava'...
remote: Counting objects: 85770, done.
remote: Compressing objects: 100% (77/77), done.
接收对象中: 2% (1991/85770), 428.01 KiB | 5.00 KiB/s
ref site: