场景:
Git 版本大于等于 2.28 版本中提供新功能,您可以使用init.defaultBranch
更改默认分支。
所以目前本机安装的 git 版本过于老旧,需要更新到 2.28 版本以上。
查看
~ brew info git
git: stable 2.29.2, HEAD
Distributed revision control system
https://git-scm.com
...
更新
brew upgrade git
更新过程如下
brew upgrade git
Updating Homebrew...
Warning: You are using macOS 11.1.
We do not provide support for this pre-release version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
pre-release version.
==> Upgrading 1 outdated package:
git 2.23.0_1 -> 2.29.2
==> Upgrading git 2.23.0_1 -> 2.29.2
==> Downloading https://ftp.gnu.org/gnu/gettext/gettext-0.21.tar.xz
Already downloaded: /Users/honglei/Library/Caches/Homebrew/downloads/fbd8967fd8256b2e1856b74e8ff0f3d8371cb652c5768e47649613a69d4dc841--gettext-0.21.tar.xz
==> Downloading https://ftp.pcre.org/pub/pcre/pcre2-10.35.tar.bz2
Already downloaded: /Users/honglei/Library/Caches/Homebrew/downloads/48997c77a7dae2fb85d52234e92e9032019609e091e23d72529d1e552978a260--pcre2-10.35.tar.bz2
==> Downloading https://mirrors.edge.kernel.org/pub/software/scm/git/git-htmldocs-2.29.2.tar.xz
Already downloaded: /Users/honglei/Library/Caches/Homebrew/downloads/121a858acf277913dc50e88327bdab2d23472eaef1be3d6d578e0d2af1581398--git-htmldocs-2.29.2.tar.xz
==> Downloading https://mirrors.edge.kernel.org/pub/software/scm/git/git-manpages-2.29.2.tar.xz
Already downloaded: /Users/honglei/Library/Caches/Homebrew/downloads/943040db2aac5a66a4faae1cb07ea9ea9a98ee2c2928750d2f86277a1b64099b--git-manpages-2.29.2.tar.xz
==> Downloading https://cpan.metacpan.org/authors/id/R/RJ/RJBS/Net-SMTP-SSL-1.04.tar.gz
Already downloaded: /Users/honglei/Library/Caches/Homebrew/downloads/0726c68dac390b617cefcc880f076b50795463c1fba286d46a53082ebed2bc9d--Net-SMTP-SSL-1.04.tar.gz
==> Downloading https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.29.2.tar.xz
Already downloaded: /Users/honglei/Library/Caches/Homebrew/downloads/6b8b369d6a5b8c38330cef909d4a876403d2badc5ab22b2118a562520da30d7c--git-2.29.2.tar.xz
==> Installing dependencies for git: gettext and pcre2
==> Installing git dependency: gettext
==> ./configure --prefix=/usr/local/Cellar/gettext/0.21 --with-included-gettext gl_cv_func_ftello_works=yes --with-included-glib --with-included-libcroco --with-included-libunistring --with-emacs --wi
==> make
==> make install
???? /usr/local/Cellar/gettext/0.21: 1,953 files, 19.8MB, built in 9 minutes 52 seconds
==> Installing git dependency: pcre2
==> ./configure --prefix=/usr/local/Cellar/pcre2/10.35 --enable-pcre2-16 --enable-pcre2-32 --enable-pcre2grep-libz --enable-pcre2grep-libbz2 --enable-jit
==> make
==> make install
???? /usr/local/Cellar/pcre2/10.35: 230 files, 6.1MB, built in 53 seconds
==> Installing git
==> make install prefix=/usr/local/Cellar/git/2.29.2 sysconfdir=/usr/local/etc CC=clang CFLAGS= LDFLAGS= NO_TCLTK=1 NO_OPENSSL=1 APPLE_COMMON_CRYPTO=1
==> make CC=clang CFLAGS= LDFLAGS=
==> make clean
==> make
==> make test
==> make CC=clang CFLAGS= LDFLAGS=
==> Caveats
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completions and functions have been installed to:
/usr/local/share/zsh/site-functions
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/git
==> Summary
???? /usr/local/Cellar/git/2.29.2: 1,479 files, 39.7MB, built in 1 minute 10 seconds
Removing: /usr/local/Cellar/git/2.23.0_1... (1,543 files, 44.9MB)
==> Upgrading 2 dependents:
libidn2 2.2.0_1 -> 2.3.0, wget 1.20.3_1 -> 1.20.3_2
==> Upgrading libidn2 2.2.0_1 -> 2.3.0
==> Downloading https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
######################################################################## 100.0%
==> Downloading https://ftp.gnu.org/gnu/libidn/libidn2-2.3.0.tar.gz
######################################################################## 100.0%
==> Installing dependencies for libidn2: pkg-config
==> Installing libidn2 dependency: pkg-config
==> ./configure --prefix=/usr/local/Cellar/pkg-config/0.29.2_3 --disable-host-tool --with-internal-glib --with-pc-path=/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig:/usr/local
==> make
==> make install
???? /usr/local/Cellar/pkg-config/0.29.2_3: 11 files, 656.6KB, built in 1 minute 37 seconds
==> Installing libidn2
==> ./configure --prefix=/usr/local/Cellar/libidn2/2.3.0 --with-libintl-prefix=/usr/local/opt/gettext --with-packager=Homebrew
==> make install
???? /usr/local/Cellar/libidn2/2.3.0: 72 files, 808.2KB, built in 56 seconds
Removing: /usr/local/Cellar/libidn2/2.2.0_1... (70 files, 700.9KB)
==> Upgrading wget 1.20.3_1 -> 1.20.3_2
==> Downloading https://www.openssl.org/source/openssl-1.1.1h.tar.gz
######################################################################## 100.0%
==> Downloading https://ftp.gnu.org/gnu/wget/wget-1.20.3.tar.gz
######################################################################## 100.0%
==> Installing dependencies for wget: openssl@1.1
==> Installing wget dependency: openssl@1.1
==> perl ./Configure --prefix=/usr/local/Cellar/openssl@1.1/1.1.1h --openssldir=/usr/local/etc/openssl@1.1 no-ssl3 no-ssl3-method no-zlib darwin64-x86_64-cc enable-ec_nistp_64_gcc_128
==> make
==> make test
==> make install MANDIR=/usr/local/Cellar/openssl@1.1/1.1.1h/share/man MANSUFFIX=ssl
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl@1.1/certs
and run
/usr/local/opt/openssl@1.1/bin/c_rehash
openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.
If you need to have openssl@1.1 first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
For pkg-config to find openssl@1.1 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
==> Summary
???? /usr/local/Cellar/openssl@1.1/1.1.1h: 8,060 files, 18.4MB, built in 8 minutes 50 seconds
==> Installing wget
==> ./configure --prefix=/usr/local/Cellar/wget/1.20.3_2 --sysconfdir=/usr/local/etc --with-ssl=openssl --with-libssl-prefix=/usr/local/opt/openssl@1.1 gl_cv_func_ftello_works=yes --disable-pcre --dis
==> make install
???? /usr/local/Cellar/wget/1.20.3_2: 49 files, 4.0MB, built in 2 minutes 17 seconds
Removing: /usr/local/Cellar/wget/1.20.3_1... (50 files, 4.0MB)
==> Checking for dependents of upgraded formulae...
==> No broken dependents found!
==> Caveats
==> git
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completions and functions have been installed to:
/usr/local/share/zsh/site-functions
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/git
==> openssl@1.1
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl@1.1/certs
and run
/usr/local/opt/openssl@1.1/bin/c_rehash
openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.
If you need to have openssl@1.1 first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
For pkg-config to find openssl@1.1 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
➜ git version
git version 2.29.2