brew update fails wtih fatal: could not read Username $ brew update
fatal: could not read Username for 'https://github.com': terminal prompts disabled
fatal: could not read Username for 'https://github.com': terminal prompts disabled
Error: homebrew/homebrew-dupes does not exist! Run `brew untap homebrew/homebrew-dupes` to remove it.
homebrew/homebrew-versions does not exist! Run `brew untap homebrew/homebrew-versions` to remove it.
After trying to fix the gitconfig in my local I found out that actually brew was the issue.

For me homebrew-dupes and homebrew-versions caused the problem. But the fix is similar to taps.

Just do

brew tap


which gives you

...
homebrew/dupes
homebrew/versions
...


a simple untap

brew untap homebrew/dupes
brew untap homebrew/versions


after which everything is ok

brew update
Already up-to-date.