How to go mod download a private remote package in Github (error: “could not read Username”)

I’m trying to access a Go private remote package on my firm’s Github inside a CircleCI’s job. I’ve managed to get it in the test job, with:

git config --global url."https://{user}:${token}".insteadOf ""

But somehow, this command doesn’t work in the build job. I have this error at the Build app Docker image step, when “RUN go mod download” is launched :

fatal: could not read Username for '': terminal prompts disabled

I’ve read a lot of issues about it (this Medium sums up soluces I’ve tried), but nothing works.

Any idea ? Many thanks !


Instead of rewriting to a URL containing credentials, you should use a git@ URL and provide a read only key on the build machine.


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