Laze

If I rest I rust !

  博客园  :: 首页  :: 新随笔  ::  ::  :: 管理

git 服务器搭建,在自己服务器上搭建私有仓库

 

git私有服务器搭建

 方式一、yum安装

# yum info git
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Available Packages
Name        : git
Arch        : x86_64
Version     : 1.8.3.1 <--- 说明:当前系统是 CentOS7.x,在 6.x 上是 1.7.1
Release     : 12.el7_4
Size        : 4.4 M
Repo        : updates/7/x86_64
Summary     : Fast Version Control System
URL         : http://git-scm.com/
License     : GPLv2
Description : Git is a fast, scalable, distributed revision control system with an
            : unusually rich command set that provides both high-level operations
            : and full access to internals.
            : 
            : The git rpm installs the core tools with minimal dependencies.  To
            : install all git packages, including tools for integrating with other
            : SCMs, install the git-all meta-package.
# yum install
-y git

 

方式二、源码包安装   --亲测可用

步骤1. 安装依赖包

# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
# yum install  gcc perl-ExtUtils-MakeMaker

 

步骤2. 卸载旧的git版本(如果之前有安装rpm包)

# yum remove git

 

步骤3. 下载&解压

# cd /usr/src
# wget https://www.kernel.org/pub/software/scm/git/git-2.5.0.tar.gz
# tar -zxvf git-2.5.0.tar.gz

 

步骤4. 编译安装

# cd git-2.5.0
# make prefix=/usr/local/git all
# make prefix=/usr/local/git install
# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
# source /etc/bashrc

 

步骤5. 检查git版本

# git --version
git version 2.5.0

 

注意:如果安装完查看版本不是我们安装的最新版,请重新执行下面的操作

# yum remove -y git
# source /etc/bashrc
# git --version

 

posted on 2019-04-19 00:39  CollinTsui  阅读(370)  评论(0)    收藏  举报