Piaf Documentation

GitHub Account Management

Actual behavior of GitHub account management through the `gh` CLI in Piaf.

Prerequisites

Piaf relies on gh (GitHub CLI), not a native OAuth integration.

  • Installation check: gh --version
  • Auth check: gh auth status

UI States (Sidebar)

Based on the sidebar implementation, the user can see:

  • GitHub not installed -> link to https://cli.github.com/
  • Not authenticated -> link to https://cli.github.com/manual/gh_auth_login
  • GitHub data loading
  • Available account (avatar, login, name)
  • Unavailable/error state

Multiple Accounts

When multiple gh accounts exist for a host:

  • Piaf displays an account selector in the sidebar.
  • Switching triggers gh auth switch --hostname <host> --user <login>.

Automatic Account Fallback

For PR/repository operations, Piaf applies fallback by host:

  1. Runs the gh command with the active account.
  2. If an access/auth error is detected, tries other valid accounts on the same host.
  3. Retrieves their token via gh auth token --hostname ... --user ....
  4. Replays the command with GH_TOKEN/GITHUB_TOKEN and GH_HOST.

GitHub Enterprise Compatibility

The host is detected from the origin remote (SSH/HTTPS):

  • git@github.com:owner/repo.git
  • ssh://git@github.enterprise.local/team/repo
  • https://github.com/owner/repo.git

Fallback therefore works on github.com and Enterprise hosts.

On this page