Generate and cache GitHub App installation tokens locally, then run gh or git with the token injected. The CLI stores your app config and encrypted private key so you can fetch short-lived tokens on demand.
- bun
npm install -g apptokenOr run with npx:
npx apptoken --help- Initialize configuration and store your private key:
apptoken init
- Start the token daemon (optional, but speeds up repeated requests):
apptoken daemon start
- Run GitHub CLI with an injected token:
apptoken gh repo list
- Run Git commands against GitHub with an injected token:
apptoken git fetch
apptoken init- interactive setup (App ID, Installation ID, PEM key, password)apptoken daemon start|stop|status- manage background token daemonapptoken gh <args...>- runghwith a fresh installation tokenapptoken git <args...>- rungitagainst GitHub with a fresh installation token
- Go to GitHub settings:
- Personal: https://github.com/settings/apps
- Organization: https://github.com/organizations/\<org>/settings/apps
- Create a new GitHub App.
- Set permissions based on the
ghandgitcommands you plan to run. - Generate and download a private key (PEM).
- Install the app on your organization or account.
- Collect the required identifiers:
- App ID: shown in the GitHub App settings page
https://github.com/settings/apps/<myapp> - Installation ID: go to (
https://github.com/settings/apps/<myapp>/installations) press cog for installations settings. URL shows thenhttps://github.com/settings/installations/<InstallationID>
- App ID: shown in the GitHub App settings page
- The private key is encrypted locally using your password.
- The daemon stores tokens in memory and fetches new ones when needed.
- Config and encrypted PEM are stored under the app config directory.
- Ensure Bun is installed and on your PATH.
- Ensure
ghis installed if using theapptoken ghcommand. - Ensure
gitis installed if using theapptoken gitcommand. - Run
apptoken --helpfor usage details.