【问题标题】:error with git (-bash: git: command not found)git错误(-bash:git:找不到命令)
【发布时间】:2012-11-11 10:48:17
【问题描述】:

我在使用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

【问题讨论】:

  • 我把 $PATH 改成了 ${PATH} 还是不行
  • 你确定 git 安装在 /usr/local/git/bin 吗?而且您不只需要 PATH 中的 /usr/local/bin 吗?您是否在修改后重新加载了 .profile(source ~/.profile)?
  • 我如何首先安装 Git?我的 gem 没有显示安装了任何 git。

标签: git console gem


【解决方案1】:

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

所以你需要做的是下载并安装Git itself

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-19
      • 2018-10-09
      • 2015-08-23
      • 1970-01-01
      • 2020-12-07
      • 1970-01-01
      • 2016-03-24
      相关资源
      最近更新 更多