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

Several situations where div is covered by iframe and their solutions

Similar structures: Copy code The code is as foll...

Summary of special processing statements of MySQL SQL statements (must read)

1. Update the entire table. If the value of a col...

How to install MySQL for beginners (proven effective)

1. Software Download MySQL download and installat...

Web project development JS function anti-shake and throttling sample code

Table of contents Stabilization Introduction Anti...

js canvas realizes circular water animation

This article example shares the specific code of ...

jQuery implements sliding tab

This article example shares the specific code of ...

JS thoroughly understands GMT and UTC time zones

Table of contents Preface 1. GMT What is GMT Hist...

mysql 5.7.19 latest binary installation

First download the zip archive version from the o...

WeChat applet implements search function and jumps to search results page

Search Page: search.wxml page: <view class=&qu...

Detailed tutorial on deploying Springboot or Nginx using Kubernetes

1 Introduction After "Maven deploys Springbo...

MySQL kill command usage guide

KILL [CONNECTION | QUERY] processlist_id In MySQL...

Rules for using mysql joint indexes

A joint index is also called a composite index. F...

How to Delete Junk Files in Linux Elegantly

I wonder if you are like me, a programmer who arr...