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
The requested URL returned error: 401 Unauthorized while accessing http://git.yourdomain.com/your/project/repo.git/info/refs
If this happens you most likely need a newer version of git.
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
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
Since we installed git in /opt/git you will need to call it directly at /opt/git/bin/git.