尝试使用
git push heroku main
将应用程序部署到 heroku 时
有错误
>> git push heroku main
remote: ! Heroku does not support Git client version git/2.39.3 (Apple Git-146).
remote: ! Please upgrade to the latest Git version.
remote: ! For more information, please see https://help.heroku.com/GJ1XRFT5/fatal-error-pushing-to-heroku-on-macos-with-git-2-39-3-apple-git-146
fatal: unable to access 'https://git.heroku.com/peaceful-brook-74638.git/': The requested URL returned error: 400
我尝试用
解决问题>> brew update
>> brew upgrade git
再次运行
git push heroku main
,但错误仍然存在
解决方案是使用
brew install git
通过 homebrew 安装 git,并覆盖 Mac 预装的 Apple git
。
brew update git
命令可能失败,并显示类似的错误消息
>>> brew update git
brew upgrade git
Error: git not installed
...
步骤:
运行
brew install git
将以下行添加到您的 shell 配置文件(例如 .bashrc、.zshrc 等):
export PATH="/usr/local/bin:$PATH"
source ~/.zshrc
git --version
以验证已安装更新的 git。