Trying to install Hugo via Homebrew - “Could Not Resolve HEAD to a Revision”

时光毁灭记忆、已成空白 提交于 2021-01-19 06:04:12

问题


I'm trying to take a stab at a new site using Hugo, and I am stuck during installation. I've installed Homebrew and when running the version, I get the following:

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

And when I run brew install hugo

I get the following:

~ % 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.

What am I doing wrong? This is the first time working in home-brew.


Edit: when running brew install --verbose Hugo, I get the following warnings:

% 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


回答1:


As illustrated by this thread, this might be related to brew itself, not so much hugo.

brew install --verbose hugo

This should give you more and allow you to see at which step brew is stuck.

[where the error occurred], I changed into that directory to find that it was empty – all that was in the dir was a .git/ folder and nothing else.

So, to restore the missing contents, I used git fetch and git pull --rebase.


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

That points to a brew configuration issue, since there is a formulae for hugo

Packages are installed according to their formulae, which live in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula

Check that Formula folder and see if hugo is missing there.
If not, at least try brew extract hugo inside a new tap.

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



回答2:


use git -C $(brew --repository homebrew/core) checkout master or git -C $(brew --repository homebrew/core) reset --hard HEAD.



来源:https://stackoverflow.com/questions/65605282/trying-to-install-hugo-via-homebrew-could-not-resolve-head-to-a-revision

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!