### git安装
* `yum install git` 安装git
* 然后要生成ssh 的公🔑和私🔑。
```
[root@VM_0_11_centos ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
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:
SHA256:TikqQHAp5foB+wFB7yXxw78quddRDsfgYDIMNFn2zk8 root@VM_0_11_centos
The key's randomart image is:
+---[RSA 2048]----+
|=*B= |
|o==+=o . |
|oo.o+*o o |
|.=. = oo = |
|+ o. o.ES |
| + o .o=.. |
| + o .oo |
| + ... |
| .+. |
+----[SHA256]-----+
```
> 以上使用的是ssh_keygen命令。
> 可以看到生成了🔑在`/root/.ssh/`
* 查看公🔑并且复制。
```
[root@VM_0_11_centos .ssh]# cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJBqlL7e13E3isNiO3Nx9+GzQMATkcaKJJWhlALfc+Wv7lV17cDOw+aPMRsUsenaC5Db/dZfWi8GaABx8jV/dYkYVT5U8RiD4SN2zJ0uT9tNjO8yp8pw3qNpAD5nmCTlQHUC+4r9ZiE2q+T2CRdOckfXJFGZBHrSOmTbAQz1VnxhuB1367LNP7SV3UJFcj/g5ZcRM5dtqVuPS/jM4fLPNLKWqnLIh7rxlrYqRsEUm/X8PFyp/brD6rZzA3Ve+dx5FU26sOmLRNQraLXiPdXNLDzp3ayBWvY9HHr7xCfMOTLQ5VHQEw72Uh2ua4W2yzfhWzMI4MdvGcem9mkKvapEhJ root@VM_0_11_centos
```
* 设置到github里面
![](https://img.kancloud.cn/99/d6/99d6bc79551e84c601615fd3aeb4dc6c_1035x387.png)
### 设置git命令自动补全
![](https://img.kancloud.cn/b3/ff/b3ff647b18bfb5c20026e971a7b9c2aa_716x342.png)
> 注意1:需要加上一句:
> `source /etc/bash_completion.d/git`
>注意2:这边同样的加上一句
```
if [-f /etc/bash_completion.d/git-completion.bash];then
source /etc/bash_completion.d/git-completion.bash
source /etc/bash_completion.d/git
fi
```