( ´∀`)文字 Moji
How-to guides

Enable GitHub search

Configure the token required by the GitHub Code Search provider.

GitHub Code Search requires authentication. Without a token, Moji keeps using GitHub's bounded unauthenticated repository, tree, and release search.

Use an existing GitHub CLI login

If GitHub CLI is installed and already authenticated, Moji automatically uses its token for GitHub.com:

gh auth login
moji "Futura" --provider github

Moji only reads an existing login with gh auth token. It never starts a login flow, stores the CLI token in Moji's config, or prints the token. An explicit GITHUB_TOKEN, github_token, or --token-stdin value takes precedence.

Use an environment variable

export GITHUB_TOKEN=github_pat_your_token
moji "Futura" --provider github

The environment variable takes precedence over github_token in the config file.

Read a token from standard input

Use --token-stdin when a secret manager or another process supplies the token:

printf '%s' "$TOKEN_FROM_SECRET_MANAGER" |
  moji "Futura" --provider github --token-stdin --json

Moji intentionally has no inline --token flag because command-line arguments can be recorded in shell history and process listings.

Store a token in the config file

Open the config:

moji config

Set:

github_token: github_pat_your_token

Moji creates the config with mode 0600. moji config show always redacts the stored value.

Recover from authentication failures

If Moji reports that GitHub search is not configured:

  1. run gh auth status if GitHub CLI should supply the token;
  2. confirm that GITHUB_TOKEN is exported in the same shell when using the environment variable;
  3. run moji config show and confirm that GitHubToken is [redacted] when using the stored token;
  4. confirm that the token can read public repositories; and
  5. retry with --provider getfonts to keep working without GitHub.

On this page