git – go get results in terminal prompts disabled error for github private repo

git – go get results in terminal prompts disabled error for github private repo

I found this extremely helpful, and it solved my problem. This command will allow your 2FA to do its thing (and save you the trouble of entering your username and password):

git config --global --add [email protected]:.insteadOf


If youre not using 2FA, you can still use SSH and this will work.

Edit: added the --add flag as suggested by slatunje.

go get disables the terminal prompt by default. This can be changed by setting an environment variable of git:


git – go get results in terminal prompts disabled error for github private repo

It complains because it needs to use ssh instead of https but your git is still configured with https. so basically as others mentioned previously you need to either enable prompts or to configure git to use ssh instead of https. a simple way to do this by running the following:

git config --global --add [email protected]:.insteadOf

or if you already use ssh with git in your machine, you can safely edit ~/.gitconfig and add the following line at the very bottom

Note: This covers all SVC, source version control, that depends on what you exactly use, github, gitlab, bitbucket)

# Enforce SSH
[url ssh://[email protected]/]
  insteadOf =
[url ssh://[email protected]/]
        insteadOf =
[url ssh://[email protected]/]
  insteadOf =
  • If you want to keep password pompts disabled, you need to cache password. For more information on how to cache your github password on mac, windows or linux, please visit this page.

  • For more information on how to add ssh to your github account, please visit this page.

Also, more importantly, if this is a private repository for a company or for your self, you may need to skip using proxy or checksum database for such repos to avoid exposing them publicly.

To do this, you need to set GOPRIVATE environment variable that controls which modules the go command considers to be private (not available publicly) and should therefore NOT use the proxy or checksum database.

The variable is a comma-separated list of patterns (same syntax of Gos path.Match) of module path prefixes. For example,

export GOPRIVATE=*,*


go env -w*
  • For more information on how to solve private packages/modules checksum validation issues, please read this article.
  • For more information about go 13 modules and new enhancements, please check out Go 1.13 Modules Release notes.

One last thing not to forget to mention, you can still configure go get to authenticate and fetch over https, all you need to do is to add the following line to $HOME/.netrc

machine login USERNAME password APIKEY
  • For GitHub accounts, the password can be a personal access tokens.
  • For more information on how to do this, please check Go FAQ page.

I hope this helps the community and saves others time to solve described issues quickly. please feel free to leave a comment in case you want more support or help.

Leave a Reply

Your email address will not be published.