18 พฤศจิกายน 2564

go get private github repo error fatal: could not read Username for 'https://github.com': terminal prompts disabled

 If your Golang repository is using modules from private GitHub, GitLab, bitbucket. 

After running "go mod download" or "go mod tidy", you may see this error

fatal: could not read Username for 'https://github.com': terminal prompts disabled


To fix the error above, please follow these steps

1. run export GOPRIVATE=github.com/your-organization/*

2. run git config --global --add url."git@github.com:".insteadOf "https://github.com/"


Verify result

1. run echo $GOPRIVATE to verify GOPRIVATE variable

2. run cat ~/.gitconfig to verify git config


บทความยอดนิยม (ล่าสุด)

บทความยอดนิยม (All Time)