tags:

views:

1024

answers:

2

I am receiving this error when I try to use git lately. I'm not exactly sure when the error started as I rarely use git. I used to use it. I didn't change anything about it or my machine that I know of. Now it doesn't work.

I've gone through and reinstalled the latest version using this installer, and I still get the same error in terminal.

Anyone heard of this before? The installer runs just fine, no errors, but it still doesn't recognize the "git" command in terminal.

I'm running OS 10.5

EDIT

Per a response down below which pointed me to my PATH variable I think that's the issue. I installed MacPorts at one point, which changed my .profile I have no idea how to change it back though. My old .profile was this:

alias g='git'
export PS1='$(git branch &>/dev/null; if [ $? -eq 0 ]; then \
echo "\[\033[00m\]$(git branch grep ^*sed s/\*\ //) "; fi)\$\[\033[00m\] '
export LC_CTYPE=en_US.UTF-8
export PATH=$PATH:/usr/local/bin

My new .profile is this:

export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH

How can I make those two files become one?

+3  A: 

From the page you linked to:

/usr/local/git/bin

Is that in your PATH?

Open ~/.profile in your favorite editor and add the line

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

This appends the item to your PATH variable (separarated by colons), so it's compatible with other commands that modify the path.

jleedev
Ah!, well that's something...but I don't know what to do. Please check the edited question.
Pselus
Do I need to logout/login to make these changes visible or should it just "work"?
Pselus
OS X sources your profile every time you open a terminal, I think.
jleedev
this worked for me in 10.6.4 as well. I had just installed MacPorts
Thomas
+1  A: 

Another way to approach this is to check to see if you have an /etc/paths.d/git file. The OSX installer should have created that file containing:

/usr/local/git/bin

so that it is picked up without any .bash_profile needed, or at least no special entries in your .bash_profile, or .profile in your case.

I just tested deleting my .bash_profile and opening a fresh shell window and I'm still able to resolve the git command.

Courtney Palit