git:找不到命令(在OS X 10.5上) [英] git: command not found (on OS X 10.5)

查看:144
本文介绍了git:找不到命令(在OS X 10.5上)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近尝试使用git时收到此错误。我不确定何时发生错误,因为我很少使用git。
我曾经使用它。我没有改变任何关于它或我知道的机器的事情。现在它不起作用。



我使用这个安装程序,我仍然在终端中得到相同的错误。



任何人都听说过这个?安装程序运行正常,没有错误,但它仍然无法识别终端中的git命令。



我正在运行OS 10.5



编辑



每个响应向下指向我的PATH变量,我认为这是问题。
我在一个地方安装了MacPorts,这改变了我的.profile
我不知道如何改回它。
我的旧.profile是这样的:

  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

我的新.profile是这样的:

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

如何让这两个文件变成一个?



  / usr 

/ local / git / bin

是否在PATH中?



在您最喜爱的编辑器中打开〜/ .profile 并添加行

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

附加t他将项目添加到PATH变量(由冒号分隔),因此它与修改路径的其他命令兼容。


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?

解决方案

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.

这篇关于git:找不到命令(在OS X 10.5上)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆