How to install git on linux

How to install git on linux

1. Introduction

Git is a free, open source distributed version control system used to handle any project, small or large, in an agile and efficient manner.

Git is an open source distributed version control system that is used to efficiently and quickly manage versions of projects ranging from very small to very large.

Git is an open source version control software developed by Linus Torvalds to help manage Linux kernel development

Installation Environment

Alibaba Cloud ECS CentOS 7.4 64-bit

2. Install git using shell

Please save the downloaded shell and the following code to the same directory

cnl_function.sh

#!/bin/bash
source ./cnl_function.sh

#function of installing git
install_git(){
  #download the compressed package
  cd /usr/local/src
  #if compressed package is empty then download
  [ -f git-2.2.1.tar.gz ] || wget https://www.kernel.org/pub/software/scm/git/git-2.2.1.tar.gz
  check_ok

  tar -zxf git-2.2.1.tar.gz
  check_ok

  [ -d /usr/local/git ] && mv /usr/local/git /usr/local/git_`date +%s`  
  cd git-2.2.1
  check_ok
  
  for p in expat-devel 
  do 
    myum $p
  done

  make prefix=/usr/local/git all
  make prefix=/usr/local/git install
  check_ok
  
  if ! grep '^git:' /etc/group
  then 
    groupadd git
  fi  
  
  if ! grep '^git:' /etc/passwd
  then
    useradd -m git -s /usr/local/git/bin/git-shell -g git
  fi  
  check_ok
  ln -s /usr/local/git/bin/git /usr/local/bin/git
  
  echo "git is installed finish."  
}

read -p "Enter (Y) to start installation git:" n
if [ $n == 'Y' ]
then 
  echo "Start installation==========================================================================================================================================================>"
  install_git
else 
  echo "Cancel the installation."
fi

As shown below, I saved the above code to cnl_install_git.sh

Execute the script and follow the prompts to enter

Command line execution

git --version

The installation is complete.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Install and use Git and GitHub on Ubuntu Linux
  • Setting up GitLab+Jenkins continuous integration environment under centos (installing Jenkins)
  • CentOS latest version git installation tutorial
  • Detailed illustration of Git client: How to install and configure GitHub operation process guide
  • Install git and common git commands on Linux system
  • The latest version of Git2.29.2 super detailed installation process (with pictures and text)

<<:  A complete guide on how to query and delete duplicate records in MySQL

>>:  A brief analysis of the configuration items of the Angular CLI release path

Recommend

How to play local media (video and audio) files using HTML and JavaScript

First of all, for security reasons, JavaScript ca...

Summary of Linux file directory management commands

touch Command It has two functions: one is to upd...

How to implement JavaScript's new operator yourself

Table of contents Constructor new Operator Implem...

How to install Element UI and use vector graphics in vue3.0

Here we only focus on the installation and use of...

MySQL 5.7.11 zip installation and configuration method graphic tutorial

1. Download the MySQL 5.7.11 zip installation pac...

Detailed explanation of the use of Linux lseek function

Note: If there are any errors in the article, ple...

MySQL reports an error: Can't find file: './mysql/plugin.frm' solution

Find the problem Recently, I found a problem at w...

HTML+CSS to achieve layered pyramid example

This article mainly introduces the example of imp...

Essential knowledge for web development interviews and written tests (must read)

The difference between inline elements and block-...

Analysis of rel attribute in HTML

.y { background: url(//img.jbzj.com/images/o_y.pn...

Descending Index in MySQL 8.0

Preface I believe everyone knows that indexes are...

Docker link realizes container interconnection

Table of contents 1.1. Network access between con...

How to filter out duplicate data when inserting large amounts of data into MySQL

Table of contents 1. Discover the problem 2. Dele...

Detailed explanation of MYSQL large-scale write problem optimization

Abstract: When people talk about MySQL performanc...