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日,已超过418天没有更新,若内容或图片失效,请留言反馈。

说明

最近使用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)

猜您想看

  • Windows10 1903版更新体验

    前一阵子太忙了,各种乱七八糟的事情,以及新备案了一个网站(某个莫名其妙的项目),所以网站关闭了好一阵子。 草稿很多,但是都没有完善,今天水一篇。

    2019年06月12日
  • 阿里云CDN加速OSS方案

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

    2021年04月28日
  • typecho无法进管理后台或无法评论的解决方案

    如题,解决typecho无法进入后台的问题

    2019年01月15日
  • A解析与CNAME冲突以及隐藏源站IP方案

    本文介绍A解析与CNAME冲突以及隐藏源站IP方案

    2019年01月22日
  • AMD R5 5600X装机记录

    在今年年初的时候,把电脑的硬件几乎都换了一遍,当时的工作比较忙,也没顾上记录,今天正好记录一下,补上为自己第二次装机之旅。

    2022年12月16日
  • 同步更新Gitee和GitHub仓库代码

    学校的网络不好,GitHub有时就上不去了,所以需要同步更新Gitee和GitHub两个仓库的代码,做个备份。

    2019年07月23日

评论区(暂无评论)

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

我要评论

Vaptcha 初始化中...