First of all, install Homebrew itself.
As the tap is a private Git repo, you need to generate a GitHub token
with repo scope and then add this token to your ~/.netrc file like this:
machine github.com
login <your GitHub user>
password <your GitHub token>
Now you can add the tap to your system:
brew tap user/repo
Afterwards, you can finally install tools provided by the tap:
Install the current version of tool XYZ:
brew install XYZ
Install the latest version of tool XYZ:
brew rm XYZ; brew install --HEAD XYZ
You can just do
brew tap <owner>/<repo>/<file> <git-clone-address>. For instance if https://github.com/cockroachdb/homebrew-tap was a private repo you'd dobrew tap cockroachdb/tap/cockroach git@github.com:cockroachdb/homebrew-tap.gitAs long as you have an SSH key added to your ssh-agent that has access to that org (i.e. you can
git clone) this will work. No need to futz with environment variables or special tokens beyond the regular setup needed for any source control system.