Differences

This shows you the differences between two versions of the page.

Link to this comparison view

centos6:build-git-from-source [2018-08-24 20:25:41] (current)
shaun.reitan created
Line 1: Line 1:
 +====== Build and Install git from source on CentOS 6 ======
 +
 +CentOS 6 comes with a packaged version of git that can easily be installed using ```yum install git``` however it's a bit old and you may run into issues with newer repo's where you 
 +see this error
 +<code console>The requested URL returned error: 401 Unauthorized while accessing http://git.yourdomain.com/your/project/repo.git/info/refs
 +</code>
 +
 +If this happens you most likely need a newer version of git.
 +
 +===== Installing git from source =====
 +
 +The following instructions will help you build and install a newer version of git. In this article we will be building version 2.9.5 and will be installing it into /opt/git
 +
 +<code console>
 +yum -y install gcc zlib-devel gettext curl libcurl libcurl-devel perl-ExtUtils-MakeMaker
 +cd /usr/src
 +wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.xz
 +tar xvf git-2.9.5.tar.xz
 +cd git-2.9.5
 +./configure --prefix=/opt/git && make && make install
 +</code>
 +
 +===== Using the new version of git =====
 +Since we installed git in /opt/git you will need to call it directly at /opt/git/bin/git.