I used the usual:
yum install git
It did not install the latest version of git on my CentOS 6. How can I update to the latest version of git for CentOS 6? The solution can be applicable to newer versions of CentOS such as CentOS 7.
I used the usual:
yum install git
It did not install the latest version of git on my CentOS 6. How can I update to the latest version of git for CentOS 6? The solution can be applicable to newer versions of CentOS such as CentOS 7.
To build and install modern Git on CentOS 6:
Adding a roundabout answer here. I was struggling to install git on an RHEL 6.0 Amazon instance, and what ended up saving me was ... conda, as in Anaconda Python.
I installed conda on the command line from the archives (code modeled after this):
and then ran
and a relatively recent version git was installed. Today is 12/26/2016 and the version is 2.9.3.
It can be very confusing, and dangerous, to replace the upstream base repositories with add-on repositories without considerable testing and thought. RPMforge, in particularly, is effectively moribund and is not getting updates.
I personally publish tools for building git 2.4, wrapped as an alternatively named "git24" package, at https://github.com/nkadel/git24-srpm/. Feel free to access and fork those if you want packages distinguished from the standard system packages, much as "samba" and "samba4" packages are differentiated.
This may be irrelevant. It is for people don't want build the latest git on the host meanwhile they still can get the latest git.
I think most people don't like building the latest git on CentOS because the dependencies will contaminate the host and you have to run lots of commands. Therefore, I have an idea which is building git inside the Docker container and then install the executable via the docker volume mount. After that, you can delete the image and container.
Yes, the downside is you have to install docker. But the least dependencies are introduced to the host and you don't have to install other yum repo.
Here is my repository. https://github.com/wood1986/docker-library/tree/master/git
Rackspace maintains the ius repository, which contains a reasonably up-to-date git, but the stock git has to first be removed.
CentOS 7 instructions:
CentOS 6 instructions:
I found this nice and easy-to-follow guide on how to download the GIT source and compile it yourself (and install it). If the accepted answer does not give you the version you want, try the following instructions:
http://tecadmin.net/install-git-2-0-on-centos-rhel-fedora/
(And pasted/reformatted from above source in case it is removed later)
Step 1: Install Required Packages
Firstly we need to make sure that we have installed required packages on your system. Use following command to install required packages before compiling Git source.
Step 2: Uninstall old Git RPM
Now remove any prior installation of Git through RPM file or Yum package manager. If your older version is also compiled through source, then skip this step.
Step 3: Download and Compile Git Source
Download git source code from kernel git or simply use following command to download Git 2.5.3.
After downloading and extracting Git source code, Use following command to compile source code.
Step 4. Check Git Version
On completion of above steps, you have successfully install Git in your system. Use the following command to check the git version
I also wanted to add that the "Getting Started" guide at the GIT website also includes instructions on how to download and compile it yourself:
http://git-scm.com/book/en/v2/Getting-Started-Installing-Git