Where is Git on Mountain Lion?
By default, git is installed on Mountain Lion in the following directory:
Adding Git to the Path
By default, the above directory is not added to the path. It can be added to the path with the following line:
Add that to PATH. And that should let you access git.
For the above to work from Terminal, add the above line to the .bash_profile.
The .bash_profile file is in the HOME directory:
$ cd ~
Listing the .bash files:
Add/change the .bash_profile file to include the above line:
$ vi .bash_profile
The version of git installed here might be different from the version you install via the Command Line Tools of Xcode.
Following was the default git version (when Mountain Lion was first installed):
$ cd /usr/local/git/bin
$ ./git --version
git version 220.127.116.11
When using git, you might also get the following error:
Cant locate SVN/Core.pm in @INC (@INC contains: /usr/local/git/lib/perl5/site_perl /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.4 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .) at /usr/local/git/libexec/git-core/git-svn line 41.
You can resolve the Perl location errors. Or, installing the Command Line Tools from Xcode (as shown below) will also fix the issue.
Adding Git from the Xcode Command Line Tools
Git can also be installed by installing the Command Line Tools from Xcode. This can be done from Preferences dialog box (Downloads section):
Figure 1. Downloading Command Line Tools from Xcode
Installing the Command Line Tools will put git in /usr/bin directory. As you can see below this version is different. Depending on when you install, this version number will be different.
$ cd /usr/bin
$ ls -la git
-rwxr-xr-x 2 root wheel 2680896 Aug 7 20:28 git
$ ./git --version
git version 18.104.22.168 (Apple Git-31.1)
Git from git-scm site
You can also download from the git official site itself. That site will, of course, have the latest git version:
The actual download packages for various operating systems (Mac, Windows, Linux, etc.) are here:
You can also download git source from here:
$ git clone https://github.com/git/git.git