Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
660 views
in Technique[技术] by (71.8m points)

macos - git: command not found (on OS X 10.5)

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 "[33[00m]$(git branch grep ^*sed s/* //) "; fi)$[33[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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...