如何将 /usr/local/git/bin/ 添加到 mac osx 上的 PATH?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5545715/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 10:32:16  来源:igfitidea点击:

how do I add /usr/local/git/bin/ to the PATH on mac osx?

gitmacos

提问by Christian

Possible Duplicate:
git: command not found

可能重复:
git:找不到命令

how do I add /usr/local/git/bin/ to the PATH on mac osx? I just installed git but it is not recognizing commands. It only responds with "command git not found", and I believe this may be the solution but I do not know how to add it to the path to be used in terminal.

如何将 /usr/local/git/bin/ 添加到 mac osx 上的 PATH?我刚刚安装了 git,但它无法识别命令。它只响应“找不到命令 git”,我相信这可能是解决方案,但我不知道如何将其添加到要在终端中使用的路径中。

回答by dearlbry

You can add the following to ~/.bash_profile:

您可以将以下内容添加到 ~/.bash_profile:

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

The change will get applied with the next terminal window you open.

更改将在您打开的下一个终端窗口中应用。