为什么 Homebrew 说“没有 git 存储库”?

oro*_*ome 7 homebrew

跑步brew --config给予

HOMEBREW_VERSION: >1.0.0 (no git repository)
...
Run Code Online (Sandbox Code Playgroud)

为什么会发生这种情况?我能做什么来修复它?


HOMEBREW_VERSION: >1.0.0 (no git repository)
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: bbed7246bc5c5b7acb8c1d427d10b43e090dfd39
Last commit: 4 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: ba0aa68066a89c0654152aba22819736b06987af
Core tap last commit: 77 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit haswell
Homebrew Ruby: 2.0.0-p648
Clang: 8.0 build 800
Git: 2.10.0 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/local/bin/ruby => /usr/local/Cellar/ruby/2.2.4/bin/ruby
Java: 1.8.0_102
macOS: 10.11.6-x86_64
Xcode: 8.0
CLT: 7.3.1.0.1.1461711523
X11: 2.7.9 => /opt/X11
Run Code Online (Sandbox Code Playgroud)

Ort*_*kni 2

正如评论中所说,这是 Homebrew 本身的一个错误,由问题 #1091描述。

此提交合并了修复:

- HOMEBREW_VERSION="$(git describe --tags --dirty 2>/dev/null)"
+ HOMEBREW_VERSION="$(GIT_DIR="$HOMEBREW_REPOSITORY/.git" git describe --tags --dirty 2>/dev/null)"
if [[ -z "$HOMEBREW_VERSION" ]]
then
  HOMEBREW_VERSION=">1.0.0 (no git repository)"
Run Code Online (Sandbox Code Playgroud)