How To Update My Version of Git on OS X 10.8

How To Update My Version of Git on OS X 10.8

Download the latest version of Git from Git Homepage or or from the direct OSX latest link. This will download the latest version of Git to your desktop/download area as a dmg file.

Open the dmg file, then Control/Right Click the git.pkg file to install.
version of git version of git

After the installation, check your version of git in the Terminal. Launch the Terminal from /Applications/Utilities then type in the following line:

    
    git --version

You will now see the version on your terminal. To check the file location of your installation, type in the following code:

    
    which git

This is what your location would look like:

    
    /usr/local/git/bin/git

Upgrading from a previous version of git to the latest 2.0.1

If you have already installed Git your system, you can upgrade to the latest version by uninstalling the previous install using the uninstall.sh file with the installation.

Go through the same process of downloading and mounting and the .dmg – then launch the Terminal.

Just drag and drop the uninstall.sh file to the Terminal window then hit enter, follow the prompts and then install the latest version of Git by opening and installing the Git package.

git2 version of git

 
[st_box title="NOTE" type="warning"]Your previous Git configuration settings and working repositories will remain intact.[/st_box]

Upgrading latest version of Git in Xcode

If you have already installed Xcode  with command line tools, then you already have Git. However, it would probably an older version which is distributed with Xcode and can be found on:

    
    /usr/local/bin

To run the latest version, follow the initial instructions here:

    
    /usr/local/git/bin/git

You need to add this latter path to your shell path to take precedence over the other path, the path will be set in either .bashrc or .bash_profile in your home directory.

So add in

    
    /usr/local/git/bin

to the path similar to the below:

    
    export PATH="/usr/local/git/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:$PATH"

Restart or reload the Terminal and the newer Git version will now be used.