git 尝试通过Homebrew安装Hugo-“无法将HEAD解析为修订版本”

pobjuy32  于 2022-12-21  发布在  Git
关注(0)|答案(5)|浏览(186)

我尝试尝试尝试在一个新的网站使用Hugo,我在安装过程中卡住了。我已经安装了Homebrew,当运行该版本时,我得到以下:

~ % brew --version
Homebrew 2.7.2
Homebrew/homebrew-core (no git repository)
Homebrew/homebrew-cask (git revision b96680c; last commit 2021-01-07)

当我运行brew install hugo
我得到了以下结果:

~ % brew install hugo
fatal: Could not resolve HEAD to a revision
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask with the name "hugo".
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

我做错什么了?这是我第一次自己酿啤酒。
编辑:当运行brew install --verbose Hugo时,我得到以下警告:

% brew install --verbose hugo

fatal: Could not resolve HEAD to a revision

==> Searching for similarly named formulae...

Error: No similarly named formulae found.

Error: No available formula or cask with the name "hugo".

==> Searching for a previously deleted formula (in the last month)...

Error: No previously deleted formula found.

==> Searching taps on GitHub...

/usr/bin/curl --disable --globoff --show-error --user-agent Homebrew/2.7.2\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 11.1\)\ curl/7.64.1 --header Accept-Language:\ en --retry 3 --location https://api.github.com/search/code\?q=user\%3AHomebrew\+path\%3AFormula\+path\%3ACasks\+path\%3A.\+filename\%3Ahugo\+extension\%3Arb\&per_page=100 --header Accept:\ application/vnd.github.v3\+json --write-out '
'\%\{http_code\} --header Accept:\ application/vnd.github.antiope-preview\+json --header Authorization:\ token\ ****** --dump-header /private/tmp/github_api_headers20210106-8376-1r02uaz
wh6knrhe

wh6knrhe1#

用途

git -C $(brew --repository homebrew/core) checkout master

git -C $(brew --repository homebrew/core) reset --hard HEAD
hfyxw5xn

hfyxw5xn2#

this thread所示,这可能与brew本身有关,而与hugo无关。

brew install --verbose hugo

这应该会给予你更多,让你看到在哪一步brew是卡住了。
[错误发生的地方],我换到那个目录,发现它是空的-目录中只有一个.git/文件夹,没有其他东西。
因此,为了恢复丢失的内容,我使用了git fetchgit pull --rebase

No available formula or cask with the name "hugo".

这就指向了brew配置问题,因为hugo有一个formulae
软件包根据其公式安装,公式位于/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
检查该Formula文件夹,查看其中是否缺少hugo
如果没有,至少在a new tap中尝试brew extract hugo

brew tap-new gohugoio/hugo
brew extract --version 0.80.0 hugo gohugoio/hugo
brew install gohugoio/hugo/hugo@0.80.0
qfe3c7zg

qfe3c7zg3#

通过运行以下两个命令设置核心

  1. rm -rf $(brew --repo自制软件/核心)
    1.自制/核心
nzkunb0c

nzkunb0c4#

我得到了同样的错误。我尝试了上面的大多数解决方案。最后这些步骤有帮助:

卸载自制程序

第一个月

手动删除此文件和两个文件夹

/usr/local/com.apple.installer.keep
/usr/local/Homebrew
/usr/var/homebrew

再次安装自制程序

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

px9o7tmv

px9o7tmv5#

运行brew doctor
并且输出:

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Homebrew/homebrew-core was not tapped properly! Run:
  rm -rf "/opt/homebrew/Library/Taps/homebrew/homebrew-core"
  brew tap homebrew/core

Warning: Some taps are not on the default git origin branch and may not receive
updates. If this is a surprise to you, check out the default branch with:
  git -C $(brew --repo homebrew/core) checkout master

按照警告下的指示去做,一切似乎都解决了。

相关问题