Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Previous version of GIT was 1.7.5.4. I decided to update to a newer version 1.7.9.4

Installer showed it was installed, but when checking the version number in the terminal it showed that it was still version 1.7.5.4

Currently I'm not the only one with this problem.

I've already checked if the paths are ok in .bash_profile.

share|improve this question

4 Answers 4

Did 1.7.9.4 get installed into a directory that is later in your path than the directory containing 1.7.5.4? I'm assuming (perhaps wrongly) that you have both versions installed in different directories.

share|improve this answer
up vote 1 down vote accepted

My $PATH was looking like: /usr/local/git/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/opt/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/mysql/bin:/Users/robert/.rvm/bin:/usr/local/git/bin/:/usr/local/git/bin/

I'checked some files like : .bash_profile/.profile/.bashrc there were some export $PATH declarations.

/usr/bin/git --version => git version 1.7.5.4

/usr/local/git/bin/git --version => git version 1.7.10.1

First I removed the export PATH declarations. They were messing things up. It is kind of strange that the uninstaller of v1.7.5.4 is locating git at /usr/local/git and it is installed here at /usr/bin/git. I always used the official installer.

Then I read somewhere else that xcode also installs git (think this should be the /usr/bin/git). So I'm not planning to remove this one.

So first I removed all my export PATH declarations from .bash_profile/.profile/.bashrc. This makes my path looks like: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/opt/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/mysql/bin:/Users/robert/.rvm/bin

Somewhat shorter. When I did 'which git' it gave me /usr/bin/git. This isn't the version I want. So I went back and changed my PATH to /usr/local/git/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/opt/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/mysql/bin:/Users/robert/.rvm/bin by adding this line: export PATH=/usr/local/git/bin:$PATH to .bash_profile

First open a new terminal window to test "git --version" or "which git" or if you want to test those commands in the same terminal type in first "source .bash_profile" to enable your changed in the .bash_profile file

/usr/local/git/bin (the 1.7.10.1 version) will be found first ('which git' resulted in /usr/local/git/bin/git)

share|improve this answer

check which directory the git version that you want is in... mine was in usr/local/git/bin

in order to add this to the PATH accordingly (even though it was already theoretically in the PATH, I had to add it at the beginning to take precedence over the git 1.7.5.4 in the other folder) I added the following lines to my .bash_profile:

PATH = "/usr/local/git/bin:${PATH}"
export PATH

I then quit terminal and started it up again to give it a chance to piece together the new PATH and it worked for me.

For anyone who is a total noob like me and didn't know how to access .bash_profile, this is how I got to it (using vim text editor):

vi ~/.bash_profile
share|improve this answer

So, this is a bit old, but I have the answer to your original question. The answer is here: http://code.google.com/p/git-osx-installer/issues/detail?id=67

The problem isn't with .bashrc or .bash_profile. The problem is in /etc/paths and /etc/paths.d. The OS X installer adds git to /usr/local/git/bin. It also adds /usr/local/git/bin to the /etc/paths.d.

If I understand correctly, /usr/bin precedes /usr/local in /etc/paths, so the version of git in /usr/bin/git (the Xcode version) is used. However, for some reason adding a trailing slash to the entry in /etc/paths.d will force the system to use the /usr/local/git/bin version instead.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.