马春杰杰 Exit Reader Mode

macOS更新Git版本

1、安装Homebrew

2、安装Git

命令:brew install git

# mcj @ M1_Max in ~ [15:40:08] 
$ brew install git
Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-services, skipping update!
Running `brew update --auto-update`...
==> Homebrew collects anonymous analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics have been recorded yet (nor will be during this `brew` run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

Installing from the API is now the default behaviour!
You can save space and time by running:
  brew untap homebrew/core
  brew untap homebrew/cask
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
deadfinder   flowpipe     icloudpd     mtm          openjph      tfautomv
==> New Casks
cleanupbuddy        easydevo            mumuplayer          nrfutil

You have 1 outdated formula installed.

==> Fetching dependencies for git: gettext
==> Fetching gettext
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/gettext-0.22.4.arm6
######################################################################### 100.0%
==> Fetching git
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/git-2.43.0.arm64_ve
######################################################################### 100.0%
==> Installing dependencies for git: gettext
==> Installing git dependency: gettext
==> Pouring gettext-0.22.4.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/gettext/0.22.4: 2,042 files, 24.3MB
==> Installing git
==> Pouring git-2.43.0.arm64_ventura.bottle.tar.gz
==> Caveats
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.
Subversion interoperability (git-svn) is now in the `git-svn` formula.

zsh completions and functions have been installed to:
  /opt/homebrew/share/zsh/site-functions
==> Summary
🍺  /opt/homebrew/Cellar/git/2.43.0: 1,638 files, 50.5MB
==> Running `brew cleanup git`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> git
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.
Subversion interoperability (git-svn) is now in the `git-svn` formula.

zsh completions and functions have been installed to:
  /opt/homebrew/share/zsh/site-functions

重新打开一个终端,输入:git version,就会发现已经是最新了~

$ git version
git version 2.43.0

有可能你安装Git之后还是原来的版本,那就重新链接一下就行了~

brew link git --overwrite

此时git的地址变为了:

$ which git
/opt/homebrew/bin/git