[root@localhost ~]# ssh-keygen -t rsa # 创建密钥
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
70:4f:c1:c0:4f:a9:82:8e:f2:ae:ae:c1:dc:a3:1f:f2 root@localhost.localdomain
The key's randomart image is:
+--[ RSA 2048]----+
| ..o.. |
| . +. |
| .. .+. |
| . .o.o. |
| o .S . |
|+ o . |
|.* + |
| .= o |
|==oE |
+-----------------+
[root@localhost ~]# scp ~/.ssh/id_rsa.pub 192.168.3.163:/home/git/.ssh/authorized_keys # 复制到远程 github 的服务器上
root@192.168.3.163's password:
id_rsa.pub 100% 408 0.4KB/s 00:00
在客户端上(自己pc)克隆远程仓库
[root@localhost tmp]# git clone git@192.168.3.163:/data/gitroot/sample.git
Cloning into 'sample'...
warning: You appear to have cloned an empty repository.
[root@localhost tmp]#