arch -arm64 brew install cocoapods 报错 fatal: not in a git directory Error: Command failed with exit 128: git
fatal: not in a git directory
Error: Command failed with exit 128: git
- 1
- 2
如下:
➜ arch -arm64 brew install cocoapods
Warning: No remote ''origin'' in /opt/homebrew/Library/Taps/homebrew/homebrew-cask, skipping update!
Warning: No remote ''origin'' in /opt/homebrew/Library/Taps/homebrew/homebrew-core, skipping update!
Warning: No remote ''origin'' in /opt/homebrew/Library/Taps/homebrew/homebrew-services, skipping update!
Warning: Treating cocoapods as a formula. For the cask, use homebrew/cask/cocoapods
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/ca-certificates-2022-04-26.all.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/openssl%401.1-1.1.1o.arm64_monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/readline-8.1.2.arm64_monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/ruby-3.1.2.arm64_monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/cocoapods-1.11.3.arm64_monterey.bottle.tar.gz
######################################################################## 100.0%
==> Installing dependencies for cocoapods: ca-certificates, openssl@1.1, readline and ruby
==> Installing cocoapods dependency: ca-certificates
fatal: not in a git directory
Error: Command failed with exit 128: git
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
解决办法:
brew -v 查看会有两个提示,提示用户设置 homebrew-cask 和 homebrew-core 的文件路径为设置为safe.directory, 即使用如下命名:
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask
- 1
- 2
之后再执行 arch -arm64 brew install cocoapods 即可,操作如下
➜ ~ brew -v
Homebrew 3.4.11
fatal: unsafe repository (''/opt/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 /opt/homebrew/Library/Taps/homebrew/homebrew-core
Homebrew/homebrew-core (no Git repository)
fatal: unsafe repository (''/opt/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 /opt/homebrew/Library/Taps/homebrew/homebrew-cask
Homebrew/homebrew-cask (no Git repository)
➜ ~ git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
➜ ~ git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask
➜ ~ brew -v
Homebrew 3.4.11
Homebrew/homebrew-core (git revision e913920c28f; last commit 2022-05-18)
Homebrew/homebrew-cask (git revision 17edd4ce59; last commit 2022-05-18)
➜ ~ arch -arm64 brew install cocoapods
Warning: No remote ''origin'' in /opt/homebrew/Library/Taps/homebrew/homebrew-services, skipping update!
Warning: Treating cocoapods as a formula. For the cask, use homebrew/cask/cocoapods
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/ca-certificates-2022-04-26.all.bottle.tar.gz
Already downloaded: /Users/morris/Library/Caches/Homebrew/downloads/66ab11fb867e9c78860f502908686ed6f07cb9ecdae61bdeab62941e7c8a499c--ca-certificates-2022-04-26.all.bottle.tar.gz
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/openssl%401.1-1.1.1o.arm64_monterey.bottle.tar.gz
Already downloaded: /Users/morris/Library/Caches/Homebrew/downloads/e3aecc896492e01daa0070a88ed73d200d10e4b8073faf09aa0c9be6209466b1--openssl@1.1-1.1.1o.arm64_monterey.bottle.tar.gz
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/readline-8.1.2.arm64_monterey.bottle.tar.gz
Already downloaded: /Users/morris/Library/Caches/Homebrew/downloads/39a84bfc99390b41af3e6aa9252a345e71111216ca4365ac1356c989d9b5994e--readline-8.1.2.arm64_monterey.bottle.tar.gz
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/ruby-3.1.2.arm64_monterey.bottle.tar.gz
Already downloaded: /Users/morris/Library/Caches/Homebrew/downloads/40fd5625e22759f6659af43db2d4e490677d1a69d8daa88f5aca0e42a4658a81--ruby-3.1.2.arm64_monterey.bottle.tar.gz
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/cocoapods-1.11.3.arm64_monterey.bottle.tar.gz
Already downloaded: /Users/morris/Library/Caches/Homebrew/downloads/2a567318ae0c575fe9cce953ae04e584427d01a6a536575471a115d612d909a1--cocoapods-1.11.3.arm64_monterey.bottle.tar.gz
==> Installing dependencies for cocoapods: ca-certificates, openssl@1.1, readline and ruby
==> Installing cocoapods dependency: ca-certificates
==> Pouring ca-certificates-2022-04-26.all.bottle.tar.gz
==> Regenerating CA certificate bundle from keychain, this may take a while...
🍺 /opt/homebrew/Cellar/ca-certificates/2022-04-26: 3 files, 215.6KB
==> Installing cocoapods dependency: openssl@1.1
==> Pouring openssl@1.1-1.1.1o.arm64_monterey.bottle.tar.gz
🍺 /opt/homebrew/Cellar/openssl@1.1/1.1.1o: 8,089 files, 18MB
==> Installing cocoapods dependency: readline
==> Pouring readline-8.1.2.arm64_monterey.bottle.tar.gz
🍺 /opt/homebrew/Cellar/readline/8.1.2: 48 files, 1.7MB
==> Installing cocoapods dependency: ruby
==> Pouring ruby-3.1.2.arm64_monterey.bottle.tar.gz
🍺 /opt/homebrew/Cellar/ruby/3.1.2: 15,996 files, 42.8MB
==> Installing cocoapods
==> Pouring cocoapods-1.11.3.arm64_monterey.bottle.tar.gz
🍺 /opt/homebrew/Cellar/cocoapods/1.11.3: 13,496 files, 28.3MB
==> Running `brew cleanup cocoapods`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51