在使用brew 安装scrcpy的时候出现以下问题:
==> Installing dependencies for scrcpy: dav1d, frei0r, bdw-gc, libffi, pkg-config, guile, libtasn1, nettle, p11-kit, libevent, unbound, gnutls, lame, fribidi, pcre, [email protected], glib, libpthread-stubs, xorgproto, libxau, libxdmcp, libxcb, libx11, libxext, libxrender, lzo, pixman, cairo, gobject-introspection, graphite2, harfbuzz, libass, libbluray, cjson, cmocka, mbedtls, librist, libsoxr, libvidstab, libogg, libvorbis, libvpx, opencore-amr, little-cms2, openjpeg, opus, rav1e, flac, libsndfile, libsamplerate, rubberband, sdl2, snappy, speex, srt, leptonica, libb2, lz4, libarchive, tesseract, theora, x264, x265, xvid, zeromq, zimg, ffmpeg and libusb
==> Installing scrcpy dependency: dav1d
fatal: not in a git directory
Error: Command failed with exit 128: git
经过一番折腾,记录以下解决方式:
通过brew -v命令来查看下是否有以下提示:
Homebrew 3.4.10-54-g987e688
fatal: unsafe repository ('/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
Homebrew/homebrew-core (no Git repository)
fatal: unsafe repository ('/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask' is owned by someone else)
To add an exception for this directory, call:
git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
Homebrew/homebrew-cask (no Git repository)
如果出现以上信息的话,只需要安装上面的提示执行以下命令:
git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git config --global --add safe.directory /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
问题找到解决方式之后,就感觉其实很简单。