zoukankan      html  css  js  c++  java
  • linux安装git

    1、简介

      Git是一款免费、开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。
      Git是一个开源的分布式版本控制系统,用以有效、高速的处理从很小到非常大的项目版本管理。
      Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件

      安装环境

      阿里云ECS CentOS 7.4 64位

    2、使用shell安装git

      请将下载的shell与下面代码保存到同一目录

      cnl_function.sh下载

     1 #!/bin/bash
     2 source ./cnl_function.sh
     3 
     4 #function of installing git
     5 install_git(){
     6     #download the compressed package
     7     cd /usr/local/src
     8     #if compressed package is empty then download
     9     [ -f git-2.2.1.tar.gz ] || wget https://www.kernel.org/pub/software/scm/git/git-2.2.1.tar.gz
    10     check_ok
    11 
    12     tar -zxf git-2.2.1.tar.gz
    13     check_ok
    14 
    15     [ -d /usr/local/git ] && mv /usr/local/git /usr/local/git_`date +%s`    
    16     cd git-2.2.1
    17     check_ok
    18     
    19     for p in expat-devel 
    20     do 
    21         myum $p
    22     done
    23 
    24     make prefix=/usr/local/git all
    25     make prefix=/usr/local/git install
    26     check_ok
    27     
    28     if ! grep '^git:' /etc/group
    29     then 
    30         groupadd git
    31     fi    
    32     
    33     if ! grep '^git:' /etc/passwd
    34     then
    35         useradd -m git -s /usr/local/git/bin/git-shell -g git
    36     fi    
    37     check_ok
    38     ln -s /usr/local/git/bin/git /usr/local/bin/git
    39     
    40     echo "git is installed finish."    
    41 }
    42 
    43 read -p "Enter  (Y) to start installation git :" n
    44 if [ $n == 'Y' ]
    45 then 
    46     echo "Start installation==============================================================================================================================>"
    47     install_git
    48 else 
    49     echo "Cancel the installation."
    50 fi
    51 
    52  

      如下图,我将上面代码保存位cnl_install_git.sh 

      

      执行脚本,按提示输入即可

      

      命令行执行

       git --version 

      

      安装完成。

      

    写的文章仅供自己参考,仅供自己参考,仅供自己参考,免得太久没有使用忘记了。
  • 相关阅读:
    php max()函数 语法
    php min()函数 语法
    php mt_rand()函数 语法
    php rand()函数 语法
    php pi()函数 语法
    php trim()函数 语法
    php chop()函数 语法
    php rtrim()函数 语法
    php ltrim()函数 语法
    php is_file()函数 语法
  • 原文地址:https://www.cnblogs.com/chennl/p/10177426.html
Copyright © 2011-2022 走看看