CentOS 安装配置Git服务器

本文介绍如何在 CentOS 6.5 上卸载原生 Git 版本并安装最新版本,包括下载、编译、安装及环境配置等步骤,并解决了安装过程中可能出现的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

参考:http://blog.csdn.net/yingzinanfei/article/details/53165369‘

          https://www.cnblogs.com/grimm/p/5368777.html


  • CentOS6.5自带的git版本是1.7.1

  • 卸载自带的git

# yum remove git
  • 下载最新版git
# wget https://github.com/git/git/archive/v2.15.1.tar.gz  (这里不知道怎么去找最新版本,后来去官网找了新的版本号,将此处替换)
  • 解压
# tar zxvf v2.15.1.tar.gz
# cd git-2.15.1
  • 编译安装
# make --prefix=/usr/common/git all
# make --prefix=/usr/common/git install
# cd 
# vim .bashrc

在最后一行添加
export PATH=/usr/common/git/bin:$PATH
保存后使其立即生效
# . .bashrc

  • 查看是否安装成功
#git --version

  • 创建仓库
[root@init ~]# cd /usr/common            #进入目录
[root@init common]# ll
total 4
drwxr-xr-x. 5 root root 4096 Jan 12 22:01 git
[root@init common]# mkdir gitrepo        #创建一级目录
[root@init common]# cd gitrepo
[root@init gitrepo]# ll
total 0
[root@init gitrepo]# mkdir project1      #创建二级目录
[root@init gitrepo]# cd project1/
[root@init project1]# ls
[root@init project1]# git init --bare    #初始化仓库
Initialized empty Git repository in /usr/common/gitrepo/project1/
[root@init project1]# ls                 #查看初始化以后的目录
branches  config  description  HEAD  hooks  info  objects  refs
[root@init project1]# 




仓库的使用:

1、在其它PC上找到需要下载项目的目录,右键,Git Clone



2、配置地址:ssh://root@192.168.58.100/usr/common/gitrepo/project1



3、输入密码后,克隆完成:






安装插曲:

插曲1:

Git在make的时候报错:Can't locate ExtUtils/MakeMaker.pm in @INC

解决方法如下:

yum -y install perl-devel perl-CPAN

git 需要perl来编译。然后重新make

 

插曲2:

  Git Make时出现:tclsh failed; using unoptimized loading

  MSGFMT    po/bg.msg make[1]: *** [po/bg.msg] 错误 127

  yum install tcl  build-essential tk gettext

 

插曲3:

安装之后使用https操作git 出现 :fatal: Unable to find remote helper for 'https'

yum install -y curl curl-devel

然后重新安装 git


插曲4:

Can't locate ExtUtils/Embed.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.

到网上搜索, 需要安装perl-ExtUtils-Embed: 

   yum install perl-ExtUtils-Embed -y

插曲5:
   在编译doc目标时,可能会报下面的错:
            /bin/sh: line 1: asciidoc: command not found
   这个包可以到这里下载并执行make(./configure ;make ;make install)常用方法安装http://sourceforge.net/projects/asciidoc

插曲6:
  报错:XSLTPROC user-manual.html时报错
  过程:yum search  XSLTPROC
[root@bogon git-master]# yum search XSLTPROC
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: mirrors.163.com
============================== Matched: XSLTPROC ===============================
libxslt.i386 : Library providing the Gnome XSLT engine
libxslt.x86_64 : Library providing the Gnome XSLT engine

  解决:yum install libxslt.x86_64

插曲7:

    /bin/sh: line 1: xmlto: command not found
    yum install xmlto




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值