1. Uninstall the git1.7.1 that comes with CentOS:
Using git–version to view the version of the system, CentOS should have its own version of Git that is 1.7.1
Terminal input:yum remove git
2. Install the required packages
Terminal input:yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
Yum Install gcc Perl-extutils-makemaker
3. Download the git2.2.1 and add git to the environment variable
(1) Terminal input:wget https://github. COM/git/git/archive/v2. 2.1. tar.gz
or open input directly in the browser: https://mirrors.edge.kernel.org/pub/software/scm/git/
Select the version you want to download and upload it to the Linux server under the appropriate path
(2) Unzip:tar zxvf v2. 2.1. tar.gz
(3) Terminal input:
CD git-2.7.0
Make Prefix=/usr/local/git All
Make Prefix=/usr/local/git Install
(4) Configuring environment variables
sudo vim/etc/profile
Export path= $PATH:/usr/local/git/bin
Save and exit
(5) Terminal input:source/etc/profile
4.Git Configuration in Jenkins
(1) Click "System Management"
(2) Click "Global Tool Configuration"
(3) Fill in name and path to git executeable (if git plugin is already installed in "plugin management")
If you don't know which path your git is installed on, the terminal executes whereis git
(4) Click on the created job, such as the test shown above, click "Configure"
(5) Click "Source Control", select Git, enter Git address, click Add
(6) Type selection: Username with password, input Username and password
(7) Click "Save"
Note: Some deceptive things encountered, no matter how you configure, always error, such as, if encountered this error, then immediately check the Global tool configuration git path is correct, the environment variable is correct, if all correct, or error, click on "Source Management" add, will username with Password, switch to other options, then Cancel, lie down, normal, surprise
Linux Jenkins configuration Git