Hugo mod failing in v0.91.1 but works in v0.91.0

Hi,

I’m stumped with this one, only 1 project I have is affected. Here are the details.

When using the following commands:

hugo mod get -u
hugo mod get -u ./...
hugo mod vendor

It is failing with the following errors: (truncated)

hugo: downloading modules …
go: errors parsing go.mod:
/path/go.mod:6:2: require github.com/YourOnly-One/hugo-semantic-web: git ls-remote -q origin in /tmp/hugo_cache/modules/filecache/modules/pkg/mod/cache/vcs/random_numbers_and_letters: exit status 128:
	git@github.com: Permission denied (publickey).
	fatal: Could not read from remote repository.
	
	Please make sure you have the correct access rights
	and the repository exists.
/path/go.mod:7:2: require github.com/bep/docuapi: git ls-remote -q origin in /tmp/hugo_cache/modules/filecache/modules/pkg/mod/cache/vcs/random_key: exit status 128:
	git@github.com: Permission denied (publickey).
	fatal: Could not read from remote repository.
	
	Please make sure you have the correct access rights
	and the repository exists.

WARN 2021/12/23 17:32:25 failed to download modules: failed to execute 'go [mod download]': failed to execute binary "go" with args [mod download]: go: errors parsing go.mod:
/path/go.mod:6:2: require github.com/YourOnly-One/hugo-semantic-web: git ls-remote -q origin in /tmp/hugo_cache/modules/filecache/modules/pkg/mod/cache/vcs/some_random_alphanummeric: exit status 128:
	git@github.com: Permission denied (publickey).
	fatal: Could not read from remote repository.
	
	Please make sure you have the correct access rights
	and the repository exists.
/path/go.mod:7:2: require github.com/bep/docuapi: git ls-remote -q origin in /tmp/hugo_cache/modules/filecache/modules/pkg/mod/cache/vcs/some_random: exit status 128:
	git@github.com: Permission denied (publickey).
	fatal: Could not read from remote repository.
	
	Please make sure you have the correct access rights
	and the repository exists.

And so on for every module.

When I tested it with my other projects with hugo modules but it is working fine. But with this project, it is failing in v0.91.1.

Additional information/checks:

  • I use GPG as SSH (sample of my setup: How to enable SSH access using a GPG key for authentication)
    • I mentioned this because using GPG as SSH doesn’t leave a ~/.ssh/id_ file so if we follow the Troubleshooting from Github, ssh -vT git@github.com will appear as missing a key even though that same command reports You've successfully authenticated. (Could be related or not.)
  • SSH key is present locally and in Github account. I can SSH pull and push using git command
  • When I downgraded to Hugo v0.91.0 the mentioned hugo commands work smoothly in the affected project.

Anything I missed?

Thank you. Shalom.

Hmm … I don’t know; I added GOMODCACHE env var in that release to fix another issue, which may have caused a side effect (but that sounds strange). I will test your site. Do you know what Go version you’re building with?

So, I’m guessing that the latest update somehow forced a redownload of your Hugo Modules … What happens when you in 0.91.0 do hugo mod clean and then build? Or maybe even hugo mod clean --all?

The Go version in my system is currently v1.17.5.

I tried a combination just in case:

  • If I try hugo mod clean --all in 0.91.0 it works too. But if I try it in v0.91.1, same error.
  • I also tried hugo mod clean --all in 0.91.0 then tried hugo mod get -u in v0.91.1, same error.
  • hugo mod clean --all then hugo mod get -u in 0.91.0; then hugo mod get -u in 0.91.1 the error is shorter:
go get: module github.com/YourOnly-One/hugo-semantic-web: git ls-remote -q origin in /tmp/hugo_cache/modules/filecache/modules/pkg/mod/cache/vcs/random_alphanumeric: exit status 128:
	git@github.com: Permission denied (publickey).
	fatal: Could not read from remote repository.
	
	Please make sure you have the correct access rights
	and the repository exists.
go get: module github.com/bep/docuapi/v2: git ls-remote -q origin in /tmp/hugo_cache/modules/filecache/modules/pkg/mod/cache/vcs/random_alphanumeric: exit status 128:
	git@github.com: Permission denied (publickey).
	fatal: Could not read from remote repository.
	
	Please make sure you have the correct access rights
	and the repository exists.

Can you try:

export HUGO_SECURITY_EXEC_OSENV=".*"

And then 0.91.1 …

It worked with export HUGO_SECURITY_EXEC_OSENV=".*":

  • hugo mod clean -all from 0.91.0 to hugo mod get -u in 0.91.1
  • hugo mod clean -all and hugo mod get -u directly in 0.91.1
1 Like

That puzzles me a little, but I will revert the commit I suspect to be the culprit and remind myself not to make changes that I “assume will do the job” …

1 Like

Thank you, it’s weird indeed, at least on my end it’s only happening in 1 project. I hope a solution can be found, I’m thinking the HOME whitelist is needed in another feature.