Builds, investigations, prototypes, and remote Planners that run on paired machines connect to GitHub as Chopin's GitHub App (<slug>[bot]), never as a person's personal account. For each piece of work, Chopin's server requests a short-lived GitHub App installation token limited to one repository and valid for one hour. Because GitHub issues these tokens only to requests signed with the App's private key, the server needs your App ID and private key. Before issuing any token, Chopin verifies that the person who requested the work has push access to that repository, and the resulting pull requests credit that person.
This guide explains how to configure that identity. It assumes your GitHub App is already registered and installed, as described in Register the GitHub App.
- For an organization-owned App: an organization owner or a GitHub App manager for that App.
- For a personal App: the account owner.
You also need permission to edit your Chopin server's configuration and restart the server.
Every machine token requests only these repository permissions. Your App must declare each required permission, and every installation must accept it.
| Permission | Access | How the token uses it |
|---|---|---|
| Contents | Read and write | Required. Fetches code and pushes branches. Prototype tokens request read-only access. |
| Pull requests | Read and write | Required. Opens and updates pull requests and requests reviewers. |
| Metadata | Read-only | Granted automatically to every GitHub App. Lets Chopin verify whether a user can push. |
| Workflows | Read and write | Optional. Lets builds modify .github/workflows. Requested only when the installation grants it; without it, GitHub blocks pushes to workflow files. |
Permissions granted per job type:
| Launch | Token permissions | Credited user |
|---|---|---|
| A build, rebuild or investigation | Contents and Pull requests write, Metadata read, Workflows write if given | The person who started it |
| A prototype | Contents read, Metadata read | The person who started it |
| A Planner running on a machine | Contents and Pull requests write, Metadata read, Workflows write if given | The machine's owner |
The App's other permissions (Checks, Commit statuses, Issues) are used by signed-in users in the browser, not by machine tokens. See Repository permissions.
-
Open your GitHub App settings. On GitHub, click your profile picture and choose:
- Settings for a personal App; or
- Your organizations, then Settings next to the organization for an organization App.
Go to Developer settings > GitHub Apps, then click Edit next to your App (
https://github.com/settings/apps/<slug>orhttps://github.com/organizations/<org>/settings/apps/<slug>). -
Open Permissions & events and confirm Contents and Pull requests are set to Read and write. If you change any permission, click Save changes and have each installed account accept the updated permissions on GitHub.
-
Open General. Under About, copy the numeric App ID. Do not confuse it with the Client ID next to it (which goes in
GITHUB_APP_CLIENT_ID). -
Open Credentials > Key pairs and click New key (or click Generate a private key under Private keys at the bottom of General). Your browser downloads a
.pemfile named<slug>.<date>.private-key.pem. GitHub keeps only the public key, so if you lose the file you must generate a new key. -
Verify the downloaded file matches the fingerprint GitHub displays for the new key:
openssl rsa -in <downloaded>.pem -pubout -outform DER | openssl sha256 -binary | openssl base64
-
Copy the
.pemfile to your Chopin server (for example withscp), store it readable only by the user running Chopin, and remove the temporary upload:sudo install -D -m 0600 -o <service-user> <uploaded>.pem /etc/chopin/github-app.pem rm <uploaded>.pem
Chopin's Docker image runs as user ID
1000, so use-o 1000 -g 1000for Docker deployments. Delete the downloaded copy on your laptop too. If your hosting platform mounts secrets from a secret manager, store the key there instead. Never commit the private key, paste it into chat or issues, or log it. Chopin never prints the key or its path. -
Add these two settings to your server's environment file (such as
/etc/chopin/chopin.env):GITHUB_APP_ID=<App ID from step 3> GITHUB_APP_PRIVATE_KEY_FILE=/etc/chopin/github-app.pem
For Docker, set
GITHUB_APP_PRIVATE_KEY_FILE=/run/secrets/github-app.pemand mount the host file read-only into the container:--volume /etc/chopin/github-app.pem:/run/secrets/github-app.pem:ro
If your hosting platform only accepts inline environment variables, use
GITHUB_APP_PRIVATE_KEYinstead, with line breaks written as\n. Set eitherGITHUB_APP_PRIVATE_KEY_FILEorGITHUB_APP_PRIVATE_KEY, never both.Also ensure
GITHUB_APP_SLUGmatches your App's URL slug so Chopin can look up<GITHUB_APP_SLUG>[bot]. -
Restart Chopin (for Docker, recreate the container with the new volume mount). Both the server and
bun run migrateread the key once at startup.
At startup. If the configuration is invalid, Chopin and bun run migrate stop immediately with a clear error:
| Error | How to fix it |
|---|---|
GITHUB_APP_ID must be the GitHub App's numeric ID |
Use the numeric App ID from step 3, not the Client ID. |
GITHUB_APP_ID needs GITHUB_APP_PRIVATE_KEY or GITHUB_APP_PRIVATE_KEY_FILE |
Provide the private key file or inline key from step 7. |
Set GITHUB_APP_PRIVATE_KEY or GITHUB_APP_PRIVATE_KEY_FILE, not both |
Keep only one of the two variables. |
GITHUB_APP_PRIVATE_KEY_FILE can't be read |
Fix the file path or permissions. Inside Docker, use the path inside the container. |
The GitHub App private key must be a PEM private key |
Provide the entire .pem file, including the -----BEGIN and -----END lines. |
The GitHub App private key must be an RSA key |
Use a private key generated by GitHub for this App. |
Startup checks only the format of the key and does not call GitHub, so step 5's fingerprint check is the fastest way to catch a mismatched key.
From a paired machine. On a paired machine that has a checkout registered with chopin connect --checkout <path>, run:
chopin status --jsonConfirm that plain chopin status prints connector protocol 7 or later on its first line (older connectors do not run this check). In the JSON output, inspect the github field, which shows whether Chopin can mint a token for each registered repository:
"github": { "octo-org/score": "ok" }| Result | Meaning |
|---|---|
ok |
Chopin can issue a GitHub App token for this repository. No token was minted during the check. |
| A refusal | One of the codes under Refusals. Plain chopin status also prints a sentence explaining the problem next to that checkout. |
unknown |
Chopin could not verify access: the machine is unpaired or rejected, the server is unreachable or outdated, or GitHub rejected the App key. |
In the server log. Every token issued writes one log line without exposing the token value:
chopin: GitHub App token (run build) for machine <machine-id> in octo-org/score, run <run-id>, document <document-id>, for mona
If Chopin refuses to issue a token, the job or Planner does not start. The machine never silently falls back to the owner's personal GitHub login. Every refusal names the affected repository.
| Code | Why it happened | How to fix it |
|---|---|---|
no-grant |
The server is missing GITHUB_APP_ID or the private key. |
Follow Set it up. |
app-cannot-push |
The App is not installed on the repository, its installation is suspended, it lacks required permissions, or <GITHUB_APP_SLUG>[bot] could not be found. |
Install the App on the repository, approve pending permission updates, or fix GITHUB_APP_SLUG. |
starter-cannot-push |
The user who triggered the job (or the machine owner for a Planner or chopin status) does not have push access, or their GitHub username now belongs to another account. |
Grant that user write access to the repository, then retry. |
repository-forbidden |
The machine owner cannot access the repository through the App installation. | Install the App on the repository or grant the machine owner access. |
run-unknown |
The run already finished, moved to another machine, or targets another repository. | Start the build or investigation again. |
- Connectors on protocol 7 or later receive
no-grant, so builds, investigations, prototypes, and remote Planners do not start. - Older connectors temporarily fall back to the owner's personal GitHub token and log
chopin: legacy GitHub token for machine <machine-id> in octo-org/score: its connector predates App installation tokens. - Under
AUTH_MODE=local, Chopin never issues GitHub tokens to machines, with or without a key.
Configure the App key on your server before users upgrade to newer chopin CLI releases.
A GitHub App can hold up to 25 keys at once, so always add the replacement key before deleting the old one.
- Generate and install the new key by repeating steps 4 to 6 of Set it up, replacing
/etc/chopin/github-app.pem. - Restart Chopin (for Docker, start a fresh container so it mounts the new key).
- Confirm it works under Check it works.
- In the App's GitHub settings, open Credentials > Key pairs, click Delete next to the old key's fingerprint, and confirm.
If a key ever leaks, follow the same steps immediately. Deleting the key prevents any new tokens from being minted, and any token already issued expires within one hour.
- Pull requests and commits are authored by the bot account
<slug>[bot]with the email<bot-id>+<slug>[bot]@users.noreply.github.com. - The pull request description ends with a line such as
Requested by @mona in https://chopin.example/... Built by a coding agent with Chopin's GitHub App. - Chopin asks the coding agent to request a review from the person who started the build.
- Every commit includes a trailer crediting the requester as a GitHub co-author:
Co-authored-by: Mona Lisa <583231+mona@users.noreply.github.com>.
The coding agent adds the last three items based on Chopin's prompt; if one is missing, the agent omitted it.