redhat7.2安装与配置git

git的安装

  • 搭建本地yum仓库或者使用网络yum仓库;
  • yum安装git软件
[root@foundation16 ~]# yum install git -y

git的配置

linux操作系统的配置

[root@foundation16 ~]# git config  --global user.name 'lvah'
[root@foundation16 ~]# git config  --global user.email 'your email'
[root@foundation16 ~]# cat -b .gitconfig
     1  [user]
     2      name = lvah
     3      email = your email address
[root@foundation16 ~]# 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:
78:fb:1c:3e:af:a9:5c:7c:bb:af:bb:ec:84:b4:c2:d1 
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|                 |
|       . .       |
|      . S E      |
|       o = o     |
|        + * o    |
|       . *.* .   |
|        o.*=X*.  |
+-----------------+
[root@foundation16 ~]# cat ~/.ssh/id_rsa.pub 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDvbV+gbUu3jDh0cWDCilS6prrp3NHK3KN4oMbtP0LdL9eS/QNSV0hyxMp+GujfbWjvk+pQdymM3iofe9X1fSVTlRrriY0e0Jmxzj5T2uuNN3uEoDj7esPAsDwK8EkCJ2s5iCDpj0F8CnYPvrsx0Q7u4nO6Be8MqqRxrxdq6tbYYXkYDtwBagStc7Gi/mzYAnQlF+CRTeXv3u7uq/0p9+Z61dM+hVx1vw/nr54fFITQZM13j0pcdmTl1LTClY5A8nBh6fIF0oYz4/43hCDhoWafQbPZVtFZe3sQrF+athXTCdDmO55/qEcAcX/SSglHGmEVcQgSu55pgOmL9Qs7j3m9 976131979@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是否配置成功?

[root@foundation16 .ssh]# ssh -T [email protected]
The authenticity of host 'github.com (192.30.255.112)' 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.255.112' (RSA) to the list of known hosts.
Hi lvah! You've successfully authenticated, but GitHub does not provide shell access.

你可能感兴趣的:(技术)