[Solved] go get results in ‘terminal prompts disabled’ error for github private repo

I created the private repo examplesite/myprivaterepo using the Github UI from my browser.

Then I went to my go directory (on the desktop) and cloned it:

$ cd $GOPATH
$ go get

So far so good. Created the file scheduler.go, added to repo, and pushed.

$ vim scheduler.go
$ git add scheduler.go
$ git commit
$ git push

Everythng’s OK. But when I went to a clean laptop and tried to clone the repo, I got an error:

# Now on laptop, which doesn't yet know about the repo
$ cd $GOPATH
$ go get
# At this point it should ask for my user ID and password ,right? But it doesn't.
# Instead, this error occurs:
cd .; git clone /Users/tom/go/src/
Cloning into '/Users/tom/go/src/'...
fatal: could not read Username for '': terminal prompts disabled
package exit status 128

Why is my laptop hating on my own repo and how can I get it to accept its fate? Thanks.

Enquirer: tomcam


Solution #1:

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 url."[email protected]:".insteadOf ""


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

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

Respondent: Wylliam Judd

Solution #2:

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

Respondent: Shafreeck Sea

Solution #3:

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 url."[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 Go’s 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.

Respondent: Muhammad Soliman

Solution #4:

1st — go get will refuse to authenticate on the command line. So you need to cache the credentials in git. Because I use osx I can use osxkeychain credential helper.

2nd For me, I have 2FA enabled and thus could not use my password to auth. Instead I had to generate a personal access token to use in place of the password.

  1. setup osxkeychain credential helper
  2. If using TFA instead of using your password, generate a personal access token with repo scope
  3. git clone a private repo just to make it cache the password git clone and used your username for username and the generated personal access token for password.
  4. Removed the just cloned repo and retest to ensure creds were cached — git clone and this time wasnt asked for creds.

    1. go get will work with any repos that the personal access token can access. You may have to repeat the steps with other accounts / tokens as permissions vary.
Respondent: Mike Graf

Solution #5:

If you just want go get to work real fast, and move along with your work…


$ go get [whatever]

It will now prompt you for a user/pass for the rest of your shell session. Put this in your .profile or setup git as above for a more permanent solution.

Respondent: EdH

Solution #6:

From go 1.13 onwards, if you had already configured your terminal with the git credentials and yet facing this issue, then you could try setting the GOPRIVATE environment variable. Setting this environment variable solved this issue for me.

export{organizationName/userName of the package}/*  
Respondent: Luna Lovegood

Solution #7:

I had the same problem on windows “error: failed to execute prompt script (exit code 1)
fatal: could not read Username for ‘‘: No error” trying to login to github through the login dialog. When I canceled the dialog git asked me for login and password in the command line and it worked fine.

Respondent: Nick Proto

Solution #8:

If you configure your gitconfig with this option, you will later have a problem cloning other repos of GitHub

git config --global --add url. "[email protected]". Instead, ""

Instead, I recommend that you use this option

echo "export GIT_TERMINAL_PROMPT=1" >> ~/.bashrc || ~/.zshrc

and do not forget to generate an access token from your private repository. When prompted to enter your password, just paste the access token. Happy clone 🙂

Respondent: cooljl86

Solution #9:

I faced this error terminal prompts disabled after changing my credentials, Carthage failed to update the dependencies and show this error on terminal.

I just did the simple following steps and it’s started working…

  1. Remove old credentials from keychain access
  2. Tried to clone the same repo in different location.
  3. It asked for credentials (username + password) to set.
  4. And then Carthage update worked as before.
Respondent: RJ168

Solution #10:

Add this is your bash_profile:


Then run:

git config --global --add url. "[email protected]". Instead, ""
Respondent: Vikram Biwal

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy