Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is git looking in the wrong directory for the git installation? (OS X)

I am new to OS X and cannot find anywhere how to fix this. I installed git but the installation was messed up and I had to remove it. I installed it using the latest git dmg file but whenever I type in

git

I get

-bash: /usr/bin/git: No such file or directory

That is because git is not installed in that directory and instead in /usr/local/bin/git

If I type in the entire path to the directory than I get the correct output.

So what did I do wrong and how do I fix it? Thanks.

like image 359
Kevin Colin Avatar asked Oct 31 '13 05:10

Kevin Colin


People also ask

How do I change where git installs?

The default path is “C:\Program Files\Git“. If you want the software installed in a different location click Browse and specify a different folder. Click Next when ready to proceed. On this step, you are prompted to provide the name of the Start Menu folder in which the shortcuts for the application will be placed.

How do I find where git is installed on my Mac?

How do I know if Git is installed? To see if Git is installed on your system, open your terminal and type git --version . If your terminal returns a Git version as an output, that confirms you have Git installed on your system. If not, you have to download Git for Mac or Windows.

Where do I put git path in VS code?

Open setting. json(or File>Preferences>Settings). Navigate to Workspace Settings. Find "Path" and add paths to Git bin and cmd folders.

Is git already installed on Mac?

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!


2 Answers

I know this is over a year old but just for anyone who experiences this issue:

I had a similar issue after renaming the OS X provided git client and installing using Homebrew. I found the issue was due to the current terminal session. The OP has the correct paths so I wouldn't recommend editing the /etc/paths file.

If after running which -a git you see /usr/local/bin/git everything should be correctly configured, open a new terminal and you should be able to run git with no errors.

Running which git should now output /usr/local/bin/git.

like image 138
bvpb Avatar answered Oct 05 '22 08:10

bvpb


It's not in your $PATH. It's installed in /usr/local/bin/git but your path only has

/usr/local/git/bin. Fixing the path should work.

like image 41
jcm Avatar answered Oct 05 '22 07:10

jcm