Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updated Git but still showing old version

I downloaded and installed Git 1.8.4.2 from this link: http://git-scm.com/downloads. However, when I run git --version from the Terminal I get:

[~/workspace/ruby]:  git --version 
git version 1.7.4.4

I've tried restarting the terminal and my computer. I then tried using the info at https://code.google.com/p/git-osx-installer/wiki/Uninstall. I did the following in the terminal from within /usr:

sudo rm -rf /usr/local/git
sudo rm /etc/paths.d/git
sudo rm /etc/manpaths.d/git

I then ran the new git .dmg file again but am still getting 1.7.4.4 when I run git --version. I suppose there's something going on here with the Mac filesystem that I don't understand. Any help would be greatly appreciated!

like image 592
sixty4bit Avatar asked Dec 11 '13 00:12

sixty4bit


People also ask

How do I update my Git software?

Download the installation file from the Git website. Run the installation and follow the install wizard to update Git to the latest version. Note: Using the install wizard to update Git overwrites the current installation.

How do I know if I have Git already?

Check If Git is Installed You can check whether Git is installed and what version you are using by opening up a terminal window in Linux or Mac, or a command prompt window in Windows, and typing the following command: git --version.

Is git already installed on Linux?

Git can be installed on the most common operating systems like Windows, Mac, and Linux. In fact, Git comes installed by default on most Mac and Linux machines!


1 Answers

Run the command:

which git

You'll probably see /usr/bin/git -- the Apple supplied version. This will be because /usr/bin appears in your PATH environment variable before /usr/local/git/bin. You can verify this by running the command:

echo $PATH

If that is the case then run this command:

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

and then try git --version again. You should now get 1.8.4.2. This hasn't fixed it permanently yet though. You'll need to add the export PATH=... line to your ~/.bashrc so that it gets set for every shell.

like image 107
sjs Avatar answered Nov 16 '22 01:11

sjs