git的安装
- 搭建本地yum仓库或者使用网络yum仓库;
- yum安装git软件
git的配置
linux操作系统的配置
[[email protected] ~]# git config --global user.name 'lvah'
[[email protected] ~]# git config --global user.email 'your email'
[[email protected] ~]# cat -b .gitconfig
[user]
name = lvah
email = your email address
[[email protected] ~]# ssh-keygen -t rsa -C 'your email'
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:
:fb:c:e:af:a9:c:c:bb:af:bb:ec::b4:c2:d1
The key's randomart image is:
+--[ RSA ]----+
| |
| |
| |
| . . |
| . S E |
| o = o |
| + * o |
| . *.* . |
| o.*=X*. |
+-----------------+
[[email protected] ~]# cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDvbV+gbUu3jDh0cWDCilS6prrp3NHK3KN4oMbtP0LdL9eS/QNSV0hyxMp+GujfbWjvk+pQdymM3iofe9X1fSVTlRrriY0e0Jmxzj5T2uuNN3uEoDj7esPAsDwK8EkCJ2s5iCDpj0F8CnYPvrsx0Q7u4nO6Be8MqqRxrxdq6tbYYXkYDtwBagStc7Gi/mzYAnQlF+CRTeXv3u7uq/p9+Z61dM+hVx1vw/nr54fFITQZM13j0pcdmTl1LTClY5A8nBh6fIF0oYz4/hCDhoWafQbPZVtFZe3sQrF+athXTCdDmO55/qEcAcX/SSglHGmEVcQgSu55pgOmL9Qs7j3m9 @qq.com
github的配置
- 登陆github官网;
- 输入username,mail,password登陆github;
- 登陆成功后在右上角有一下拉列表,选择setting进行设置;
- 进入setting后,在左侧有personal setting,选择SSH and GPG keys进行设置;
- 此处可选择New SSH key,分别填写title与key;
- key填写的内容为~/.ssh/id_rsa.pub的内容;
检测git是否配置成功?
[[email protected] .ssh]# ssh -T [email protected]
The authenticity of host 'github.com ()' can't be established.
RSA key fingerprint is ::ac:a5:::d:::b::d:eb:df:a6:
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,' (RSA) to the list of known hosts.
Hi lvah! You've successfully authenticated, but GitHub does not provide shell access.