Question

I just upgraded my mac to LION, and now git is gone:

$ git
-bash: git: command not found

Any ideas on how to get git back?

Was it helpful?

Solution

The default install location is /usr/local so add this to your ~/.bash_profile

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

then run source ~/.bash_profile in Terminal

OTHER TIPS

If you do not want to install XCode and/or ports/fink/homebrew, you could always use the standalone installer: http://code.google.com/p/git-osx-installer/

There are a couple of points to this answer.

Firstly, you don't need to install Xcode. The Git installer works perfectly well. However, if you want to use Git from within Xcode - it expects to find an installation under /usr/local/bin. If you have your own Git installed elsewhere - I've got a script that fixes this.

Second is to do with the path. My Git path used to be kept under /etc/paths.d/ However, a Lion install overwrites the contents of this folder and the /etc/paths file as well. That's what happened to me and I got the same error. Recreating the path file fixed the problem.

you have to find where git is and then add the folder to the PATH variables in .bash_profile.

Using terminal:

1) search for git:

sudo find / -name git

2) edit the .bash_profile add

PATH="<DIRECTORY OF GIT>:$PATH"

Git is back :-)

Anyway i suggest you to install git using macports, in this way you can easilly upgrade your git to the newest release

Hope this helps

It's part of Xcode. You'll need to reinstall the developer tools.

You can always use port

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top