(original answer mislav/hub#463 (comment))
- create token with necessary permissions (https://github.com/github/hub/blob/master/share/man/man1/hub.1.md#github-oauth-authentication)
- copy the token
- add token into keychain: security add-generic-password -a -s -w, for instance: security add-generic-password -a johndoe -s hub -w (you will be prompted twice for the token, just hit cmd+v and hit enter)
- open ~/.bash_profile with your favorite editor
- add alias: alias ghub='GITHUB_TOKEN=$(security find-generic-password -s -a -w) hub'
- reload your shell config: source ~/.bash_profile
- now you can use hub through alias ghub and it will be authorized with your token :)