If you already have an previous version of Git installed, you can clone the latest version:

git clone https://github.com/git/git.git
cd git

Now, we can actually build git


By default Git will be installed onto ~/bin. Now we install it.

make install

If the folder doesn't exist, it will be created. The only thing we need to do now is make sure that ~/bin exists in your $PATH

echo $PATH

If it doesn't, you can add it.

nano ~/.bashrc

Replace nano with whichever editor you want. At the end add:

export PATH=/home/<username>/bin:${PATH}

To exit nano




If you want to change where Git is installed to, for example, maybe /home/ruben/opt, we can substitute the make step with:

make prefix=/home/ruben/opt

Obviously replacing ruben with your username. This should work for everyone:

make prefix=${HOME}/opt

For extra options, there's an INSTALL inside the Git folder.