欢迎光临
一个学习的网站

fatal: not in a git directory Error: Command failed with exit 128: git

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

如下:

➜ 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

解决办法:

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

之后再执行 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`).

 

赞(0) 打赏
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《fatal: not in a git directory Error: Command failed with exit 128: git》
文章链接:https://zixijiaoshi.com/2955.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏