How to upgrade git 1.9.5 to 2.16.0?

I already have git version 1.9.5 installed on the machine and I need to upgrade to 2.16.0. However, after installation and I ran command git version and I am seeing version 1.8.3.1.

Can somebody please help me fixed this issue?

Based on git help -a it looks like it’s either git update or git update-git-for-windows.

If you have homebrew, you can

brew upgrade git 

// or just upgrade all your packages
brew upgrade

BTW, 2.17.0 is latest

The system is OS RHEL 6

I’d probably just compile from source for this case tbh, RHEL usually (and by design for stability reasons) keeps older versions in the repos.

You could add another repo instead: https://ius.io/#how-to-use

Otherwise to compile from source you can simply call git clone https://github.com/git/git
then cd into the git directory.

Be sure to read the INSTALL file for information about using make for the build before proceeding.

You also might be missing some build dependencies, install them with yum or whatever RHEL6’s package manager is.