Go seems to have lost track of gitconfig

Prior to some updates, Go modules were downloading perfectly fine via SSH when running hugo serve.

This was enabled by adding entries like the following to ~/.gitconfig

[url "git@github.com:user-name"]
  insteadOf = https://github.com/user-name

I now get this error:

go mod download: ... exit status 128:
	fatal: could not read Username for 'https://github.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.

I have confirmed that the SSH key is configured correctly, as I am able to clone the repos for the modules in question, via SSH.

My .gitconfig file has not changed.

Also, the same error occurs if I add tat config to .git/config within the repo.

hugo v0.92.2+extended and go version go1.17.1 on Linux.

Is there a way to double-check if go is finding .gitconfig?

Ok as per this post Hugo mod failing in v0.91.1 but works in v0.91.0 - #4 by techmagus, if I run export HUGO_SECURITY_EXEC_OSENV=".*" and then hugo serve it works. From then on it works in any other terminals without HUGO_SECURITY_EXEC_OSENV.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.