Tell git not to use the GitHub account (Keychain) for public repositories – it’s a privacy issue

githomebrewkeychainpasswordprivacy

Whenever some script or Git clones/pulls something from GitHub I don't wish to send my GitHub Account, if the repo is public.

How to make sure I won't be authenticated with my GitHub user with Keychain?

> brew search geoip
geoip                                                                                                                                geoipupdate
Error: GitHub
The GitHub credentials in the macOS keychain may be invalid.
Clear them with:
  printf "protocol=https\nhost=github.com\n" | git credential-osxkeychain erase
Or create a personal access token:
  https://github.com/settings/tokens/new?scopes=gist,public_repo&description=Homebrew
and then set the token as: export HOMEBREW_GITHUB_API_TOKEN="your_new_token"

> git credential-osxkeychain erase
host=github.com
protocol=https

Best Answer

Add the variable HOMEBREW_NO_GITHUB_API to your environment.

For example add this to your .bash_profile to turn off "once for all":

export HOMEBREW_NO_GITHUB_API=1

or put it in front of the brew for single actions:

HOMEBREW_NO_GITHUB_API=1 brew search geoip