服務器
1、簡介
Git是一款免費、開源的分布式版本控制系統(tǒng),用于敏捷高效地處理任何或小或大的項目。
Git是一個開源的分布式版本控制系統(tǒng),用以有效、高速的處理從很小到非常大的項目版本管理。
Git 是 Linus Torvalds 為了幫助管理 Linux 內核開發(fā)而開發(fā)的一個開放源碼的版本控制軟件
安裝環(huán)境
阿里云ECS CentOS 7.4 64位
2、使用shell安裝git
請將下載的shell與下面代碼保存到同一目錄
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
如下圖,我將上面代碼保存位cnl_install_git.sh
執(zhí)行腳本,按提示輸入即可
命令行執(zhí)行
git --version
安裝完成。
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持創(chuàng)新互聯(lián)。