After upgrading to go 1.17+ then you will start to see this error.
fatal: could not read Username for 'https://github.com': terminal prompts disabled
After version 1.16 you will enconter this and need to modify how go
downloads private modules on your system.
Go has a special environment variable that tells it to switch to [email protected]:
vs. https://github.com/
for private URLs. You can add this to your .rc files for your shell.
export GOPRIVATE=github.com/{private-space}
This can also be done using go env
.
go env -w GOPRIVATE=github.com/{private-space}
You need to configure git to change these URLs to use ssh
vs. https
for it to use the keys in your agent.
git config --global --add url."[email protected]:".insteadOf "https://github.com/"
Or edit the git config directly.
# Enforce SSH
[url "[email protected]/"]
insteadOf = https://github.com/
[url "[email protected]/"]
insteadOf = https://gitlab.com/
[url "[email protected]/"]
insteadOf = https://bitbucket.org/