查看目前git版本为2.23:
fox@MacBook-Air ~ % git –version
git version 2.23.0
进行升级:
fox@MacBook-Air ~ % brew upgrade git
Updating Homebrew…
==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
-=O=- # # # #
curl: (6) Could not resolve host: d29vzk4ow07wi7.cloudfront.net
==> Downloading https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3_2/portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
#################################################################################################################### 100.0%#################################################################################################################### 100.0%
==> Pouring portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
==> Auto-updated Homebrew!
Updated 3 taps (laggardkernel/tap, homebrew/core and homebrew/cask).
==> New Formulae
aerc jql node@14
….此处省略多行….
….
….
isl@0.18 name-that-hash zsh-you-should-use
isort ncspot
jpeg-xl nicotine-plus
==> Updated Formulae
Updated 4953 formulae.
==> Renamed Formulae
glibmm@2.64 -> glibmm@2.66 gtk+4 -> gtk4 now-cli -> vercel-cli prest -> prestd
gst-validate -> gst-devtools ht-rust -> xh pangomm@2.42 -> pangomm@2.46 qt5 -> qt@5
==> Deleted Formulae
avian fmsx meson-internal stlviewer
boost@1.55 geant4 mysql-connector-c++@1.1 unp64
boost@1.59 gobby ori unrar
confluent-platform godep pgplot woboq_codebrowser
curl-openssl laggardkernel/tap/overture rmtrash xspin
dtrx llvm@6 scw@1 xu4
==> New Casks
7777 munkiadmin
abyssoft-teleport mxsrvs
accordance napari
….此处省略多行….
….
….
mouse-fix zoom-outlook-plugin
mtgaprotracker zulufx
mubu zy-player
multi
==> Updated Casks
Updated 2980 casks.
==> Deleted Casks
0xed ezip odio
ableton-live facebook-ios-sdk oni
….此处省略多行….
….
….
eventstore nosql-workbench-for-amazon-dynamodb zoomus-outlook-plugin
evom noteplan
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: git not installed
出现xcrun的error错误,要安装xcode的命令行工具,执行:
xcode-select –install
如果可以执行gcc -v 表示成功:
% gcc -v
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
fox@foxdeMacBook-Air ~ % gcc -v
Configured with: –prefix=/Library/Developer/CommandLineTools/usr –with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
再次升级:
% brew upgrade git
Error:
homebrew-core is a shallow clone.
homebrew-cask is a shallow clone.
To `brew update`, first run:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch –unshallow
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch –unshallow
These commands may take a few minutes to run due to the large size of the repositories.
This restriction has been made on GitHub’s request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don’t do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
Error: git not installed
按以上报错的要求进行操作:
% git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch –unshallow
remote: Enumerating objects: 426974, done.
remote: Counting objects: 100% (426937/426937), done.
remote: Compressing objects: 100% (164312/164312), done.
remote: Total 418845 (delta 256615), reused 413945 (delta 251722), pack-reused 0
Receiving objects: 100% (418845/418845), 148.82 MiB | 10.32 MiB/s, done.
Resolving deltas: 100% (256615/256615), completed with 3770 local objects.
From https://github.com/Homebrew/homebrew-core
949956b06f..b85dc3c10d master -> origin/master
% git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch –unshallow
remote: Enumerating objects: 57831, done.
remote: Counting objects: 100% (56191/56191), done.
remote: Compressing objects: 100% (18200/18200), done.
remote: Total 51312 (delta 37652), reused 46729 (delta 33103), pack-reused 0
Receiving objects: 100% (51312/51312), 26.84 MiB | 4.76 MiB/s, done.
Resolving deltas: 100% (37652/37652), completed with 2177 local objects.
From https://github.com/Homebrew/homebrew-cask
979450149f..f676934279 master -> origin/master
再次升级:
% brew upgrade git
Updating Homebrew…
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
Updated 10 formulae.
==> New Casks
devutils
==> Updated Casks
Updated 4 casks.
Error: git not installed
这个报错网上说要重新安装git:
% brew install git
==> Downloading https://homebrew.bintray.com/bottles/gettext-0.21.catalina.bottle.tar.gz
Warning: Transient problem: timeout Will retry in 1 seconds. 3 retries left.##
Warning: Transient problem: timeout Will retry in 2 seconds. 2 retries left.
Warning: Transient problem: timeout Will retry in 4 seconds. 1 retries left.##
#=#=#
curl: (6) Could not resolve host: d29vzk4ow07wi7.cloudfront.net
Error: Failed to download resource “gettext”
Download failed: https://homebrew.bintray.com/bottles/gettext-0.21.catalina.bottle.tar.gz
以上报错明显是找不到域名ip地址,dns解析不出来。
通过网站https://www.ipaddress.com/查找 d29vzk4ow07wi7.cloudfront.net 的ip地址, vi /etc/hosts 进行绑定:
root# ping d29vzk4ow07wi7.cloudfront.net
PING d29vzk4ow07wi7.cloudfront.net (54.230.17.10): 56 data bytes
64 bytes from 54.230.17.10: icmp_seq=0 ttl=229 time=240.892 ms
再次执行:
% brew install git
Updating Homebrew…
==> Downloading https://homebrew.bintray.com/bottles/gettext-0.21.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/cdea54f52b7c36ebcb5fe26a1cf736d7cd6fd5f2fd016dd8357a8624ffd6b5f8?response-content-disposition=attachment%3Bfi
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/pcre2-10.36.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/d14484c7e5d4a74112474288bb2b2edff55be51a42fd65dd02d046d24ebb6cd7?response-content-disposition=attachment%3Bfi
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/git-2.30.1.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/0dd5f43dc263da3d87a83216392fedd96774bd0c9f89e2dc717c549b1803e8d6?response-content-disposition=attachment%3Bfi
######################################################################## 100.0%
==> Installing dependencies for git: gettext and pcre2
==> Installing git dependency: gettext
==> Pouring gettext-0.21.catalina.bottle.tar.gz
🍺 /usr/local/Cellar/gettext/0.21: 1,953 files, 19.0MB
==> Installing git dependency: pcre2
==> Pouring pcre2-10.36.catalina.bottle.tar.gz
🍺 /usr/local/Cellar/pcre2/10.36: 230 files, 6.2MB
==> Installing git
==> Pouring git-2.30.1.catalina.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/git
Target /usr/local/bin/git
already exists. You may want to remove it:
rm ‘/usr/local/bin/git’
To force the link and overwrite all conflicting files:
brew link –overwrite git
To list all files that would be deleted:
brew link –overwrite –dry-run git
Possible conflicting files are:
/usr/local/bin/git -> /usr/local/git/bin/git
/usr/local/bin/git-cvsserver -> /usr/local/git/bin/git-cvsserver
/usr/local/bin/git-shell -> /usr/local/git/bin/git-shell
Error: Could not symlink share/emacs/site-lisp/libidn/idna.el
Target /usr/local/share/emacs/site-lisp/libidn/idna.el
is a symlink belonging to libidn. You can unlink it:
brew unlink libidn
To force the link and overwrite all conflicting files:
brew link –overwrite libidn
To list all files that would be deleted:
brew link –overwrite –dry-run libidn
嗯嗯,以上没有完全安装成功,按提示进行老版本git的覆盖:
fox@foxdeMacBook-Air ~ % brew link –overwrite git
Linking /usr/local/Cellar/git/2.30.1… 213 symlinks created.
fox@foxdeMacBook-Air ~ % brew link –overwrite libidn
Warning: Already linked: /usr/local/Cellar/libidn/1.35
To relink:
brew unlink libidn && brew link libidn
最后升级成功,查看最新版本:
$ git –version
git version 2.30.1
查看当前git配置:
git config -l
filter.lfs.required=true
filter.lfs.clean=git-lfs clean — %f
filter.lfs.smudge=git-lfs smudge — %f
filter.lfs.process=git-lfs filter-process
user.name=fox
user.email=fox@abc.com
color.ui=true
credential.helper=cache –timeout=10
http.version=HTTP/1.1
http.postbuffer=524288000