brew search generates mail notification "You recently used a password to access an endpoint through the GitHub API using Homebrew/2.2.2"
I don't like that brew uses my GitHub credentials.


Brew is not using your GitHub credentials, you are.

Brew is just an exceptionally advanced scripting engine that allows you to download and build from source software that’s found on GitHub, Sourceforge, et al.  It’s important to note that you’re not downloading from Brew, but a Brew is automating your download of the software.

What steps did you take to save git keys in your shell environment?

You would reverse that to have brew not be granted access to your keys when it calls git or makes web / API calls. 


https://help.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh