git 错误(-bash: git: command not found)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13330431/
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 14:54:40  来源:igfitidea点击:

error with git (-bash: git: command not found)

gitconsolegem

提问by skip87

I am having trouble with gitcommand. I'm getting -bash: git: command not found. It's reported as installed when I run $ gem list, and i've put its path on my .profileas you can see below. I just don't understand how come it doesn't work. Thanks for the help

我在git命令方面遇到了问题。我得到-bash: git: command not found。它在我运行时报告为已安装$ gem list,并且我已将其路径放在我的路径上.profile,如下所示。我只是不明白为什么它不起作用。谢谢您的帮助

# MacPorts Installer addition on 2012-10-11_at_19:01:44: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
export PATH=${PATH}:/usr/local/mysql/bin

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

# git path

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

采纳答案by poke

The gityou have installed is a Ruby Gem that is used to access Git features from within Ruby. It does not come with the actual Git and as such does not include the command line git(I'm actually not sure if the Gem does not even needa normal Git installed).

您安装的git是一个 Ruby Gem,用于从 Ruby 中访问 Git 功能。它没有与实际的 Git 一起提供,因此不包括命令行git(我实际上不确定 Gem 是否甚至不需要安装普通的 Git)。

So what you need to do is to download and install Git itself.

所以你需要做的就是下载并安装Git 本身

回答by Pankaj Kumar Katiyar

On Mac: The best solution is to install Xcode and then go to Xcode - Preferences, and the Downloads. Here install Commandline Tools and you are good to go.

在 Mac 上:最好的解决方案是安装 Xcode,然后转到 Xcode - Preferences 和 Downloads。在这里安装命令行工具,你就可以开始了。