You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6f9ad3c
Browse filesBrowse the repository at this point in the historyBrowse files
Create GitHub App installation tokens from the app's private key
--as-app only accepts an installation token created elsewhere. Those
expire after an hour, so long backups fail part way through. With
--app-id, --app-private-key and --app-installation-id, github-backup
creates the token itself and replaces it ten minutes before it expires.
The JWT is signed by the openssl command line tool so the project keeps
zero runtime dependencies; the Docker image now installs openssl. API
requests resolve auth per request, and wiki clones rebuild their URL,
so both pick up a refreshed token mid-run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-q, --quiet supress log messages less severe than warning, e.g.
79
82
info
80
83
--as-app authenticate as github app instead of as a user.
84
+
--app-id APP_ID github app id or client id; creates and refreshes
85
+
installation tokens (implies --as-app)
86
+
--app-private-key APP_PRIVATE_KEY
87
+
path to the github app private key (.pem), optionally
88
+
as file://...
89
+
--app-installation-id APP_INSTALLATION_ID
90
+
id of the github app installation to back up
81
91
-o, --output-directory OUTPUT_DIRECTORY
82
92
directory at which to backup the repositories
83
93
-l, --log-level LOG_LEVEL
@@ -209,10 +219,19 @@ GitHub Apps are ideal for organization backups in CI/CD. Tokens are scoped to sp
209
219
6. Under "Private keys", click "Generate a private key" and save the downloaded file
210
220
7. Go to *Install App* in your app's settings
211
221
8. Select the account/organization and which repositories to back up
222
+
9. Note the **installation ID**: the number at the end of the installation's settings URL (``.../settings/installations/<id>``)
212
223
213
-
**CI/CD usage with GitHub Actions:**
224
+
**Using the app's private key:**
214
225
215
-
Store the App ID as a repository variable and the private key contents as a secret, then use ``actions/create-github-app-token``::
226
+
Pass the App ID, private key file and installation ID, and github-backup creates installation tokens itself, refreshing them before they expire so long-running backups keep working::
``--app-id`` implies ``--as-app`` and cannot be combined with ``-t``, ``-f``, ``--token-from-gh`` or the keychain options. The ``iss`` claim of the signed JWT is set to the value of ``--app-id``, so the app's client ID works there too. The JWT is signed by the ``openssl`` command line tool, which must be on your ``PATH`` (the Docker image includes it).
231
+
232
+
**Using an existing installation token:**
233
+
234
+
If something else already creates the installation token, pass it with ``-t`` and ``--as-app``. In GitHub Actions, store the App ID as a repository variable and the private key contents as a secret, then use ``actions/create-github-app-token``::
216
235
217
236
- uses: actions/create-github-app-token@v1
218
237
id: app-token
@@ -222,7 +241,7 @@ Store the App ID as a repository variable and the private key contents as a secr
Note: Installation tokens expire after 1 hour. For long-running backups, use a fine-grained personal access token instead.
244
+
Note: Installation tokens passed with ``-t`` expire after 1 hour and are not refreshed. For backups that may run longer, use ``--app-private-key`` instead.
0 commit comments