Git must be installed and in your PATH!
胸弟,你是不是升级了macOS 系统 ?
搬砖期间别搞事情哈,不要升级!!!不然半天不能干活你就被领导盯上了。
好的吧,无论啥原因,下面来抢救一下(贴出git官网教程,建议第一种 homebrew 安装方式)
1.检查brew有没有安装,如果没有就执行以下代码
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
如果你等待一段时间之后遇到下面提示,就说明无法访问官方脚本地址:
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation timed out
请使用下面的脚本:
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
如果命令执行中卡在下面信息:
==> Tapping homebrew/core Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
请Command + C
中断脚本依次执行如下命令:
cd "$(brew --repo)/Library/Taps/"
mkdir homebrew && cd homebrew
git clone git://mirrors.ustc.edu.cn/homebrew-core.git
成功执行之后继续执行前文的安装命令。
最后看到==> Installation successful!
就说明安装成功了。
最最后执行:brew update
安装成功以后用 brew -v 检查如下:
2.再执行:brew install git 安装git
嫌弃git下载速度慢?请兄台移步到我另一篇博客有教程,阿里嘎多!
3.brew有安装但报错?
Git must be installed and in your PATH!
xcode-select --install
执行上面命令安装成功以后,再执行 brew install git
4.git安装成功