首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用brew在MacOS上安装特定的git版本

使用brew在MacOS上安装特定的git版本
EN

Stack Overflow用户
提问于 2021-10-08 18:37:50
回答 1查看 470关注 0票数 1

我正在尝试从brew安装较旧的git版本。

我已经安装了git 2.33.1

代码语言:javascript
复制
▶ brew info git
git: stable 2.33.0 (bottled), HEAD
Distributed revision control system
https://git-scm.com
/usr/local/Cellar/git/2.33.0_1 (1,508 files, 42MB) *
  Poured from bottle on 2021-10-08 at 12:06:00
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/git.rb
License: GPL-2.0-only
==> Dependencies
Required: gettext ✔, pcre2 ✔
==> Options
--HEAD
    Install HEAD version
==> Caveats
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/git
==> Analytics
install: 198,758 (30 days), 658,960 (90 days), 2,607,801 (365 days)
install-on-request: 194,065 (30 days), 644,952 (90 days), 2,558,858 (365 days)
build-error: 0 (30 days)

我需要(出于某些故障排除目的)一个旧版本,即2.25.1

为什么看起来没有其他(更老的)版本可用?

代码语言:javascript
复制
▶ brew install git@2.25.1
Warning: No available formula or cask with the name "git@2.25.1".
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

我也尝试过this更老的话题的建议,但没有任何运气。

EN

回答 1

Stack Overflow用户

发布于 2021-10-13 03:42:09

https://docs.brew.sh/Tips-N'-Tricks#installing-previous-versions-of-formulae

安装某些公式的特定版本的受支持方法是查看是否有可用的版本化公式(例如gcc@7)。如果您正在寻找的版本不可用,请考虑使用brew extract

运行以下命令以创建名为$USER/local-tap的tap,将git 2.25.1解压缩到tap中,然后安装:

代码语言:javascript
复制
brew tap-new --no-git $USER/local-tap
brew extract --version=2.25.1 git $USER/local-tap
brew install git@2.25.1
/usr/local/opt/git@2.25.1/bin/git --version
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69500383

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档