6

Through Xcode 4.3 ->file -> source control -> repositories -> clone repository, I've cloned a repository from codesion.com. but when I go a git init or git add, the error -bash: git: command not found shows up. Now, Xcode 4.3 comes with the git installed, so what should I do to get this working?

Any help on this would be great.

Thanks in advance.

2 Answers 2

8

There is another option if you're not experienced with UNIX or you just don't want to mess with the system variables from the terminal. I had the same problem, and after some reading on SO and apple developer pages I've decided to install the Command Line Tools for Xcode. That solved the problem.

As the Xcode IDE from some 4.x version is an .app package and everything is stored inside that package, they have added the possibility to separately install the command line tools so that you have the command line tools inside the usr/bin/ path.

You can install the command line tools (as well as some other tools and documentation) from the Downloads tab of the Preferences window in Xcode (I have version 4.3), or from the apple developer website.

Sign up to request clarification or add additional context in comments.

1 Comment

Had same problem. Installed Mountain Lion and as unexpected side-effect Xcode command line tools has disappeared...
2

It's a path issue. See this question for the answer:

How to move GCC in osx from xcode to /usr/bin

(P.S. The question is different, but the answer the same.)

5 Comments

i tried that but it did not work in OSX lion i tried setting up the path to export PATH=/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH as I have Xcode 4.3 installed that that's where Xcode keeps the git files..
@user962724 If you echo $PATH from the command line do you see /Applications/Xcode..etc..?
no i do not. it gives me this... I have changed the details in the .profile and also in .bash_profile and .bashrc just to eb safe.. echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Developer/usr/bin/
sheesh!. i had to restart my machine and then the change PATH variable came through in echo... is there a way to change the $PATH without having to restart the machine?
@user962724 You can restart the terminal, or type export PATH="blah_blah:$PATH" at the command line, or (sometimes) source the changed config file like . .bashrc` (the dot command sources a script). Of course, rebooting does it too... ;-)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.