linux 安装git环境变量配置

时间:2021-09-13 16:13:26

cd /usr/local

mkdir git

源码安装

cd git 

wget https://www.kernel.org/pub/software/scm/git/git-2.7.3.tar.gz

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

tar xf git-2.7.3.tar.gz cd git-2.7.3
make configure
./configure --prefix=/usr/local/git make profix=/usr/local/git make install

 

配置环境

[root@bogon git-2.3.0]# echo "export PATH=$PATH:/usr/local/git/bin" > /etc/profile.d/git.sh
[root@bogon git-2.3.0]# source /etc/profile.d/git.sh
[root@bogon git-2.3.0]# git --version
git version 2.3.0
[root@bogon git-2.3.0]# 

[root@bogon local]# cd git 

[root@bogon git]# mkdir -p git-repo
[root@bogon git]# ll
total 6196

[root@bogon git]# git config --global user.name "chen1932390299"
[root@bogon git]# git config --global user.email 1932390299@qq.com
[root@bogon git]# git config --list
user.name=chen1932390299
user.email=1932390299@qq.com
[root@bogon git]# cd git-repo/
[root@bogon git-repo]#  echo “README” > readme.txt
[root@bogon git-repo]# ll
total 4
-rw-r--r--. 1 root root 11 Apr 20 15:04 readme.txt
[root@bogon git-repo]# git init
Initialized empty Git repository in /usr/local/git/git-repo/.git/
[root@bogon git-repo]# cd ~
[root@bogon ~]# mkdir .ssh
[root@bogon ~]# cd .ssh
[root@bogon .ssh]# ssh-keygen -t rsa -C "1932390299@qq.com"
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:
8c:fa:e5:3a:a4:48:c8:fe:58:41:7f:99:5c:e6:90:8d 1932390299@qq.com
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|        +        |
|   .   E +       |
|  . . .oB        |
|.. . ..=S.       |
|... ..o          |
|.. o.o  .        |
| .+ ...o         |
| ...  oo.        |
+-----------------+
[root@bogon .ssh]# cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA5wZoqfl3kpLnugTku4J10JhuKJLZq/0RBBfsRrO7OtBzjBjnGCBvdGY3K+2m0IMu5UGhXgdBRPMVtxKG1QlYxKEVmgQpaEpZnsXsG0wDKHsgrn3oBgD59mpdvIGOh6korJ/GBlYRF4Djw0YmtTRFTcv5Jx5AAo7lTXYkJttcm4rxFhLsXg/gZNoyBlRzH+AQXQQjajYyvnx4+dJMXxEizrebNSmVxnLyotGovCnza/jSC617ASi0AOoyrWM5RHUsvnf92LmUwk+LR6Eyz97Aa6tyl1r5G8sR0VV/k+koxKHSXxn1cxozmNPdqJZ2fLiisUp9oTa0S9I3RCqS7zAWLw== 1932390299@qq.com
[root@bogon .ssh]#