MacOS更新Git
如默
撰写于 2023年 03月 05 日

说明

最近使用Mac电脑,发现Git不知道怎么升级,查了一下,特此记录

步骤

首先,在terminal执行

which git
/usr/bin/git

会显示

/usr/bin/git

再执行

git --version

会显示

git version 2.37.1 (Apple Git-137.1)

这个时候用的Xcode上的Git,再执行

brew install git
HOMEBREW_BREW_GIT_REMOTE set: using https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git as the Homebrew/brew Git remote.
remote: Enumerating objects: 326, done.
remote: Counting objects: 100% (326/326), done.
remote: Compressing objects: 100% (48/48), done.
remote: Total 631 (delta 305), reused 278 (delta 278), pack-reused 305
Receiving objects: 100% (631/631), 307.39 KiB | 17.08 MiB/s, done.
Resolving deltas: 100% (331/331), completed with 94 local objects.
From https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew
   10dd6a30c..8051e8818  master     -> origin/master
HOMEBREW_CORE_GIT_REMOTE set: using https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git as the Homebrew/homebrew-core Git remote.
Running `brew update --auto-update`...
remote: Enumerating objects: 1184, done.
remote: Counting objects: 100% (1184/1184), done.
remote: Compressing objects: 100% (98/98), done.
remote: Total 1673 (delta 1162), reused 1086 (delta 1086), pack-reused 489
Receiving objects: 100% (1673/1673), 1.10 MiB | 22.95 MiB/s, done.
Resolving deltas: 100% (1192/1192), completed with 223 local objects.
From https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core
   f8376785ae6..78c20992775  master     -> origin/master
==> Fetching dependencies for git: gettext and pcre2
==> Fetching gettext
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/gettext-0.
######################################################################## 100.0%
==> Fetching pcre2
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/pcre2-10.4
######################################################################## 100.0%
==> Fetching git
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/git-2.39.2
######################################################################## 100.0%
==> Installing dependencies for git: gettext and pcre2
==> Installing git dependency: gettext
==> Pouring gettext-0.21.1.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/gettext/0.21.1: 1,983 files, 20.9MB
==> Installing git dependency: pcre2
==> Pouring pcre2-10.42.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/pcre2/10.42: 230 files, 6.2MB
==> Installing git
==> Pouring git-2.39.2.arm64_ventura.bottle.1.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.39.2: 1,627 files, 48MB
==> 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地址

brew link git --overwrite

显示如下:

==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api/formul
##O#-#                                                                        
Warning: Already linked: /opt/homebrew/Cellar/git/2.39.2
To relink, run:
  brew unlink git && brew link git

关闭terminal,重新查看git版本,执行

git --version

会显示如下:

git version 2.39.2

此时已经是当前最新版本了,再核查路径:

which git

显示如下:

/opt/homebrew/bin/git

显示路径与原来的Git安装路径一致。至此,Git版本升级完毕。

MacOS更新Git

温馨提示:

本文最后更新于2023年03月05日,已超过626天没有更新,若内容或图片失效,请留言反馈。

说明

最近使用Mac电脑,发现Git不知道怎么升级,查了一下,特此记录

步骤

首先,在terminal执行

which git
/usr/bin/git

会显示

/usr/bin/git

再执行

git --version

会显示

git version 2.37.1 (Apple Git-137.1)

这个时候用的Xcode上的Git,再执行

brew install git
HOMEBREW_BREW_GIT_REMOTE set: using https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git as the Homebrew/brew Git remote.
remote: Enumerating objects: 326, done.
remote: Counting objects: 100% (326/326), done.
remote: Compressing objects: 100% (48/48), done.
remote: Total 631 (delta 305), reused 278 (delta 278), pack-reused 305
Receiving objects: 100% (631/631), 307.39 KiB | 17.08 MiB/s, done.
Resolving deltas: 100% (331/331), completed with 94 local objects.
From https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew
   10dd6a30c..8051e8818  master     -> origin/master
HOMEBREW_CORE_GIT_REMOTE set: using https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git as the Homebrew/homebrew-core Git remote.
Running `brew update --auto-update`...
remote: Enumerating objects: 1184, done.
remote: Counting objects: 100% (1184/1184), done.
remote: Compressing objects: 100% (98/98), done.
remote: Total 1673 (delta 1162), reused 1086 (delta 1086), pack-reused 489
Receiving objects: 100% (1673/1673), 1.10 MiB | 22.95 MiB/s, done.
Resolving deltas: 100% (1192/1192), completed with 223 local objects.
From https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core
   f8376785ae6..78c20992775  master     -> origin/master
==> Fetching dependencies for git: gettext and pcre2
==> Fetching gettext
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/gettext-0.
######################################################################## 100.0%
==> Fetching pcre2
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/pcre2-10.4
######################################################################## 100.0%
==> Fetching git
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/git-2.39.2
######################################################################## 100.0%
==> Installing dependencies for git: gettext and pcre2
==> Installing git dependency: gettext
==> Pouring gettext-0.21.1.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/gettext/0.21.1: 1,983 files, 20.9MB
==> Installing git dependency: pcre2
==> Pouring pcre2-10.42.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/pcre2/10.42: 230 files, 6.2MB
==> Installing git
==> Pouring git-2.39.2.arm64_ventura.bottle.1.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.39.2: 1,627 files, 48MB
==> 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地址

brew link git --overwrite

显示如下:

==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api/formul
##O#-#                                                                        
Warning: Already linked: /opt/homebrew/Cellar/git/2.39.2
To relink, run:
  brew unlink git && brew link git

关闭terminal,重新查看git版本,执行

git --version

会显示如下:

git version 2.39.2

此时已经是当前最新版本了,再核查路径:

which git

显示如下:

/opt/homebrew/bin/git

显示路径与原来的Git安装路径一致。至此,Git版本升级完毕。


赞 (1)

猜您想看

  • 组装移动固态硬盘体验

    最近发现平时用的U盘都满了,以前的硬盘也速度比较慢,正好国产固态很便宜,组装一个记录一下。

    2023年05月03日
  • 三星(SAMSUNG)970 EVO Plus使用体验

    如题,前一阵子在狗东三星自营420购入一块三星(SAMSUNG)250GB SSD固态硬盘 M.2接口(NVMe协议) 970 EVO Plus,与之前买的西数128G SATA固态一起服役。

    2020年01月16日
  • 光威天策 ddr5 6400M 32G*2套条体验

    前两天购买了阿斯加特 ddr5 6400M 32G*2套条,但是问题很多,然后换了光威天策 ddr5 6400M 32G*2套条,记录一下。

    2024年02月20日
  • 联合创新MiniLED显示器M2U一周体验

    最近买的AOC显示器出问题了,返厂检修,临时买了一个联合创新的显示器,体验一下。

    2023年02月09日
  • Android Studio设置国内镜像源

    没有科学上网工具,国内无法很好的访问Android资源,特记录国内镜像配置过程。

    2019年10月17日
  • 阿里云CDN加速OSS方案

    用户直接访问OSS资源,访问速度会受到OSS的下行带宽以及Bucket地域的限制。如果通过CDN来访问OSS资源,带宽上限更高,并且可以将OSS的资源缓存至就近的CDN节点,通过CDN节点进行分发,访问速度更快,且费用更低

    2021年04月28日

评论区(暂无评论)

这里空空如也,快来评论吧~

我要评论

Vaptcha 初始化中...