Can't use remote theme repositories after v0.91.1

I have a private Hugo theme repository on GitHub that multiple sites share which has been working well before recent updates.
So far I have been able to do this by replacing the git URL in my git config locally, along with running a script to do this on CloudCannon:

git config \
    --global \
    url."https://${user}:${personal_access_token}@github.com".insteadOf \
    "https://github.com"

This has worked well up until v0.91.2. Now when I run hugo mod get -u within my site directory I get the following error:

go get: module github.com/USER/THEME: git ls-remote -q origin in /var/folders/26/gqnv01_55p964v8yz39d51fw0000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/cache/vcs/235a1e682f371746744c788f5c36ac403a23b2815ffad84f6aa83fecb0af34e7: exit status 128:
	remote: Repository not found.
	fatal: repository 'https://github.com/USER/THEME/' not found

Is this a bug or is there a better way to use private theme repositories now?

What does git remote -v tell you? If it’s a http-link, then switch your remote to SSH and authenticate Github with a key.

This SSH key authentication thingy is not Hugo related, Hugo just uses it.

Access Github via SSH is in general always better. In my opinion.

PS: Change remote via:

git remote set-url <remote_name> <remote_url>

Where remote_name is most times origin, if not, you know what it is :wink: And remote URL is what you can copy when you check the clone button on your github repo and select the SSH option. Something like git+ssh://github@github.com/username/reponame.git.

1 Like

https://github.com/gohugoio/hugo/issues/9333#issuecomment-1022435616

On a vanilla Ubuntu installation, adding HOME was sufficient:

[security.exec]
  osEnv = ['(?i)^(PATH|PATHEXT|APPDATA|TMP|TEMP|TERM|HOME)$']

From the issue comments, Windows users have to add USERPROFILE.

Depending on how you have configured Git, you may have to add XDG_CONFIG_HOME.

One user reported the need to add SSH_AUTH_SOCK.

2 Likes

Thanks @jmooring!
On Mac OS the following worked:
export HUGO_SECURITY_EXEC_OSENV="(?i)^(PATH|HOME)$"

On CloudCannon the following worked:
HUGO_SECURITY_EXEC_OSENV=".*"

Thanks for the suggestion, It’s already connecting via ssh but jmooring’s fix worked

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