​https://help.github.com/articles/generating-ssh-keys/#platform-linux​​ 官方设置教程在这个网址

yum install git   //首先安装github

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
//运行这段代码 your_email@example.com 就是你自己的github邮箱

/* Generating public/private rsa key pair.出现:
Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]按回车
Enter passphrase (empty for no passphrase): [Type a passphrase]
# Enter same passphrase again: [Type passphrase again]输入两次密码,用来后面获取sshkey
*/
再运行

ssh-add ~/.ssh/id_rsa

运行:

cat ~/.ssh/id_rsa.pub

会拿到一段ssh-rsa 开头 your_email@example.com 结尾的key
然后拿到这段key

登陆github的网站去添加,这段教程在官网中有截图,在setting 的 SSH keys里Add ,会发帖的都会。

添加成功以后

运行:

ssh -T git@github.com

检测是否链接上
看到下面两个代码出现,你就超神一般的搞定了

[root@HTY-1 ~]# ssh -T git@github.com
The authenticity of host 'github.com (192.30.252.121)' 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,192.30.252.121' (RSA) to the list of known hosts.
Hi crazyyanchao! You've successfully authenticated, but GitHub does not provide shell access.

clone项目,运行

git clone https://github.com/JustLittleBoy/One.git