Under install Git # ultra-detailed # linux

1. Install Git

1.1 Download Git source package

Use wget to download Git source package

wget https://github.com/git/git/archive/v2.17.0.tar.gz

1.2 unzip

Use tar -zxvf command to extract v2.17.0.tar.gz archive

tar -zxvf v2.17.0.tar.gz

1.3 Installation Git required dependencies

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

It appears similar to the following prompt, press y to

...
Transaction Summary
===========================================================================================================
Install  3 Packages (+14 Dependent packages)
Upgrade             (  2 Dependent packages)

Total download size: 7.4 M
Is this ok [y/d/N]: Y

1.4 uninstall the old version of Git

When you install dependence, yum automatically install Git, Git therefore need to install the new version of the old version of Git uninstall command as follows:

yum remove git 

Halfway displays the following message, press y to

...
===========================================================================================================
 Package                    Arch                Version                        Repository             Size
===========================================================================================================
Removing:
 git                        x86_64              1.8.3.1-21.el7_7               @updates               22 M
Removing for dependencies:
 gettext-devel              x86_64              0.19.8.1-2.el7                 @base                 1.4 M
 perl-Git                   noarch              1.8.3.1-21.el7_7               @updates               57 k

Transaction Summary
===========================================================================================================
Remove  1 Package (+2 Dependent packages)

Installed size: 24 M
Is this ok [y/N]: y

1.5 Git source code compiler package

Jump to the Git source package directory using the make all command to compile

cd git-2.17.0 
make prefix=/usr/local/git all

1.6 install Git

j Git will be installed to / usr / local / git path (in fact, copy the files in nature), the command is

make prefix=/usr/local/git install 

1.7 Configuration Environment Variables

Open environment variable configuration file, the command is as follows:

vim /etc/profile 

At the bottom of plus Git configuration information input i to enter the edit mode and enter the following:

PATH=$PATH:/usr/local/git/bin 

export PATH 

Then save and exit, press esc, and then enter: wq to save and exit execution of operations


#mongodb
export PATH=$PATH:/root/mongodb/bin
PATH=$PATH:/usr/local/git/bin
export PATH


:wq       

Run the following command is configured to take effect:

source /etc/profile

View Git version 1.8

Enter the following command to check the git version installed

git --version 
git version 1.8.3.1

By checking, the installation was successful.

2. Git use in linux

Git used on linux strong reference to my two articles ->
[1] under linux using Git code uploaded to the designated branch
[2] Local pull remote repository file

Published 59 original articles · won praise 2 · Views 4663

Guess you like

Origin blog.csdn.net/lch551218/article/details/104640235
Recommended