Private Hugo Module plus Dev Containers pass-through authentication

There are a zillion similar issues, but I have failed to find this particular detail. I am attempting to setup VS Code (v1.75.1) with the Dev Containers (ms-vscode-remote.remote-containers 0.275.1) extension in order to create a Hugo (extended 0.110.0) environment. The repo utilizes a private Hugo theme relying on the GitHub authentication that Dev Containers mirrors from the host using a credential.helper. Note, I can get this working if I manually setup a token in the container, but the whole point of dev containers is to have automated clean build environments.

The error I get from Hugo is:

        Dev Containers CLI: RPC pipe not configured. Message: {"args":["git-credential-helper","get"],"stdin":"protocol=https\nhost=github.com\n"}
        fatal: could not read Username for 'https://github.com': terminal prompts disabled

The first part of that error barely registers on Google. I found one hit that referenced a person who had somehow had the environment variable REMOTE_CONTAINERS_IPC become unset. If I explicitly unset that, then the git command line will now give me the exact same error message, though strangely the auth then proceeds to work anyhow. I have yet to find a way to make ‘go mod download’ stop working.

What I have run out of is ways to debug what is going wrong. Why would Hugo be failing to pass that environment variable through? Is there a way to get detailed logs of exactly what Hugo is doing?

This is a bit of a guess, but…

This is the default securitry config for accessing your env vars (config.toml):

[security.exec]
osEnv = ['(?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\w+)$']

Try with everything allowed:

[security.exec]
osEnv = ['.*']

If that works, start with the original, and then start adding things to see what was blocked. The usual suspects include:

HOME
SSH_AUTH_SOCK
USERPROFILE --> Windows only
XDG_CONFIG_HOME
[security.exec]
osEnv = ['.*']

works great! I’ll refine it tomorrow. Thank you so much!

1 Like

Merely adding REMOTE_CONTAINERS_IPC was sufficient:

osEnv = ['(?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\w+|REMOTE_CONTAINERS_IPC)$']
1 Like

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