InnerAlien

InnerAlien

Hardware|Software

16 May 24

Upgrade Git

Some Git vulnerabilities have been patched recently, so it's a good idea to upgrade.

Git CVEs

On macOS Sonoma 14.4.1, my Git version is old and not in the list of patched versions on the CVE site.

𝝨 git --version
git version 2.39.3 (Apple Git-146)

I'm going to install a new Git via Homebrew, since I haven't done that since upgrading to Sonoma.

𝝨 brew install git
==> Downloading https://ghcr.io/v2/homebrew/core/git/manifests/2.45.1
######################################################################################################################################################### 100.0%
==> Fetching git
==> Downloading https://ghcr.io/v2/homebrew/core/git/blobs/sha256:afe93a73a2605a89e7c41ddb41159ee05081177a126507a9221265155139a5ef
######################################################################################################################################################### 100.0%
==> Pouring git--2.45.1.arm64_sonoma.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.45.1: 1,657 files, 51.6MB
==> Running `brew cleanup git`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

Checking the version I see it is still the previous version.

╭─○ …/Projects/Pomodoro/firmware took 4s
╰─𝝨 git --version
git version 2.39.3 (Apple Git-146)

Just restarting the terminal fixes it for me, but in some cases it may still show the older version. One thing to try is to tell Homebrew to overwrite the link to the non-Homebrew version.

𝝨 brew link --overwrite git
Warning: Already linked: /opt/homebrew/Cellar/git/2.45.1
To relink, run:
  brew unlink git && brew link git

Since mine was already linked I get the warning saying so. Once I restarted the terminal I see

𝝨 git --version
git version 2.45.1

🙌🏻