There are a lot of how to’s out there with several solutions including installing from source, from binaries, with an installer. Here is how I’ve done it guided by the following posts:
First, I downloaded git from its homepage in bz2 format.
Then, I compiled it and installed it using the following commands :
tar -xjf git-22.214.171.124.tar.bz2
sudo make install prefix=/opt/git
Finally, I added an alias called git to /opt/git/bin/git in my .bash_profile:
You can then configure Git with the following commands:
git config --global user.name "Your Name"
git config --global user.email "Your Email"
That’s all, you’re done.