CLI setup

For some commands, Alpa needs to communicate directly with the GitHub API and therefore needs to specify your GitHub token. To know which commands needs to use GitHub token, please see alpa-cli commands section.

Set up GitHub token for Alpa

To set up a GitHub token, follow GitHub documentation. Give this token only the rights it really needs (read/write access to the repository). You can provide this token to alpa-cli as an environment variable:

$  export ALPA_GH_API_TOKEN=your_gh_token

Caution

Make sure you leave a space before the command so that this command is not stored in the history.

Or you can specify the tokens in local configuration file.

Configuration file

If you don’t want to give access to all your repositories through the GitHub API token, GitHub offers Fine-grained personal access tokens. With these you can specify each token for each repository without worrying that alpa-cli has access somewhere it shouldn’t.

You can store multiple GitHub tokens in alpa-cli’s configuration file located in ~/.config/alpa.yaml or in /etc/alpa.yaml. The user configuration file takes precedence.

Caution

This is not the same configuration file as in <git_root>/.alpa.yaml!

The configuration file has list of GitHub token keys for each repository.

Example:

---
api_keys:
  - repo:
      name: my-repo-name
      key: my-secret-gh-token-to-my-repo-name
  - repo:
      name: another-repo
      key: my-secret-gh-token-to-another-repo
  - repo:
      name: yet-another-repo
      key: my-secret-gh-token-to-yet-another-repo

For each repo you specify name (your repository name on GitHub) and a corresponding GitHub token key to it. Alpa-cli will use only this key for communication with this repository.