Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting Github API token for Homebrew

You need to set HOMEBREW_GITHUB_API_TOKEN for homebrew to avoid rate limiting, but how do you add it to homebrew config?

like image 841
keypulsations Avatar asked Nov 21 '13 19:11

keypulsations


People also ask

How do I use GitHub token on Mac terminal?

Add your access token to the osxkeychaingit clone or git pull . When you are prompted to supply your Password for 'https://[email protected]': you enter your access token instead. Your token should now get cached in the osxkeychain automatically.

How do I manually add GitHub token?

If you are not redirected to VS Code, you can add your authorization token manually. In the browser window, you will receive your authorization token. Copy the token, and switch back to VS Code. Select Signing in to github.com... in the Status bar, paste the token, and hit Enter.

Where do I put my GitHub token?

Simply provide your GitHub username and the access token and your files are uploaded to GitHub. Use your GitHub personal access token as your password when you perform a git push to GitHub operation. If you use Windows, your old credentials may be stored in the Windows Credentials Manager.


2 Answers

You create your API token on https://github.com/settings/tokens and then set the environment variable HOMEBREW_GITHUB_API_TOKEN to the value of your token.

When creating the token, make sure that you only select the scopes you need. As pointed out in the answer by Chad, leaving all of the scopes unchecked is very reasonable!

Setting the token is done using the export command. Example:

export HOMEBREW_GITHUB_API_TOKEN=xxxx 

To make sure this is set whenever you open a terminal you can add this command to your ~/.brew_bashrc or ~/.bash_profile or any other file that is used during the initialisation of your shell file.

For future reference, this topic was discussed in the following two issues:

  • https://github.com/mxcl/homebrew/issues/21023
  • https://github.com/mxcl/homebrew/issues/21915
like image 132
reto Avatar answered Sep 20 '22 17:09

reto


Other than what @reto has already stated, it wasn't clear to me what scopes to select when creating a token. I was concerned about this, as I didn't want to allow too much.

According to https://gist.github.com/christopheranderton/8644743 they confirmed you should deselect all scopes. I've done this on my box and so far things work as expected.

like image 27
Chad Gorshing Avatar answered Sep 22 '22 17:09

Chad Gorshing