-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand security.exec.osEnv to make "hugo mod get" etc. work better out of the box on common OS setups #9333
Comments
Can you check if setting |
This worked! Should I run with this configuration, or set something more specific? |
On my machine, without this environment variable, it started asking for my Username via an interactive prompt, despite having the |
I have also faced the same issue on the same Hugo version as OP. bep's suggestion works for me as well. |
@dvdksn @khayyamsaleem @UtkarshVerma If you have some time, see if you can determine which environment variable(s) are required, starting with the usual suspects (HOME, LANG, USER, USERNAME, PWD, GOPROXY, etc.). Keep in mind that you might have to add more than one to Reference: https://gohugo.io/about/security-model/#security-policy |
We're also having the same issue here, and Bep's suggestion works as well. Thanks for the workaround! |
@nathlaroche Please see my previous comment, and help narrow this down if you can. Thanks. |
@jmooring I tried the above-mentioned env-vars, with no difference. What else should I test? |
@UtkarshVerma Look at the env vars that are set on your system. With Linux that's the |
@jmooring I investigated this bug. I narrowed down the requirements to the following:
I can understand |
On my end, I managed to narrow it down to these variables: [security]
[security.exec]
osEnv = ['(?i)^(Path|USERPROFILE)$'] Thanks everyone for your support, I'll close this ticket as I consider the problem (user error) resolved. |
Could you please not close this issue until this is fixed upstream. By that, I mean until acceptable defaults have been set for the config. |
FYI just adding |
@UtkarshVerma I'm pretty sure the XDG_CONFIG_HOME dependency is related to git, or to how you have configured git. |
Yes, I do keep my git config in XDG_CONFIG_HOME. |
Summarizing what we know so far... The current (v0.92.0) default is: [security.exec]
osEnv = ['(?i)^(PATH|PATHEXT|APPDATA|TMP|TEMP|TERM)$'] Based on the comments above, it looks like this would need to be: [security.exec]
osEnv = ['(?i)^(PATH|PATHEXT|APPDATA|TMP|TEMP|TERM|HOME|SSH_AUTH_SOCK|USERPROFILE|XDG_CONFIG_HOME)$'] |
I tracked down the env vars which were exactly required in my case -
After that, git subprocess should also be able to use the SSH socket, hence the need for The final regex with which I tested was: (?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|XDG_CONFIG_HOME|SSH_AUTH_SOCK)$ |
Please let me know if you need additional information on this issue. #9333 (comment) has been working for me consistently. It would be great to have this fixed upstream. |
This is relevant for hugo modules from private (under adfs sso) gitlab repositories, when GOPRIVATE env is needed. Eventually I had to set [security]
exec.osEnv =".*" |
I was having problems with Hugo Modules and a private git repository as well. I have a The fix is to add Is there a problem adding it there by default again? Right now, without |
Upon further investigation, and as cited in previous comments, I also needed So my # other configs...
[security]
[security.exec]
osEnv = '(?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\w+|HOME|SSH_AUTH_SOCK)$' A consequence of putting this in our project config is that if the default ever changes, we won't automatically pick up the changes (could be seen as positive or negative). |
To fetch modules from private repositories, Hugo requires access to additional environment variables. The exact environment variables depend on the operating system. This change adds some variables that help address this issue, for common OS setups. The default config now includes the following environment variables: - HOME - XDG_CONFIG_HOME - USERPROFILE - SSH_AUTH_SOCK Fixes gohugoio#9333 Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
To better support private Hugo modules and automatically launching a text editor on content creation, this change adds the following environment variables to the default security policy: - HOME - XDG_CONFIG_HOME - USERPROFILE - SSH_AUTH_SOCK - DISPLAY - LANG Fixes gohugoio#9333 Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
To better support private Hugo modules and automatically launching a text editor on content creation, this change adds the following environment variables to the default security policy: - HOME - XDG_CONFIG_HOME - USERPROFILE - SSH_AUTH_SOCK - DISPLAY - LANG Fixes #9333
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes
Observation
With Hugo v0.90.1 and earlier versions, I'm able to
hugo mod get -u
modules from a private registry from an on-prem gitlab instance. But with v0.91 and later, thehugo mod get -u
command just hangs.Steps to reproduce:
Then it proceeds to hang on downloading modules. With a different Hugo version:
The text was updated successfully, but these errors were encountered: