Run your own server
On this page
Migration guide: Git import, cutover and export
Moving a Git repository's history into trunkjet, verifying it, cutting over, and getting data out again. Normative sources: MASTER-SPEC 15 §2-§5 and decisions D-060 and D-065. Every command named here is in the tjet-admin reference and the tjet reference.
Git is an optional migration tool. Native operations never need it (15 §2). The import runs a
sanitized Git subprocess on the host where you run tjet-admin: hooks, replacement refs,
user/system configuration and filters are disabled.
1. Preflight
Create the target repository. A bootstrap import goes only into a repository whose stream was never integrated, so each repository can be bootstrapped once.
tjet repo create NAME [--path-profile portable-v1|posix-bytes-v1]
tjet-admin --issuer ISSUER --as SUBJECT import-git NAME /path/to/source.git --preflight-only
--preflight-only scans the whole history plus the imported ref's tree and imports nothing. It
needs stream administration. Its result lists commits, trees, blobs, blob_bytes, a
blocking flag and findings. Each finding gives a category and count, says whether the
problem still exists at the imported ref or only in history, and names the option that resolves
it. The first run of every real import repeats this scan and refuses a blocking finding
before it writes any job state or content.
Findings and their options (from tjet-admin import-git --help):
| Finding | Default | Option | Effect |
|---|---|---|---|
| Submodules (gitlinks) | omitted from the native tree and reported | --reject-gitlinks | refuse instead |
| Git LFS pointer files | refused | --keep-lfs-pointers | import the pointer files as ordinary files. The LFS objects are not fetched, so the large files are not migrated (15 §2) |
Paths invalid under the path profile (e.g. case collisions under portable-v1) | refused | --omit-invalid-paths | leave them out, each reported |
| Octopus merges with more than 64 parents | refused | --truncate-parents | keep the first 64 parents, reported |
Keep portable-v1, the default profile, unless every client is POSIX. A Linux-only profile is
never the suggested remedy for problems that exist only in history.
2. Import
tjet-admin --issuer ISSUER --as SUBJECT import-git NAME /path/to/source.git \
[--ref refs/heads/main] [--stream main] [--request-id ID] [options above]
- The command prints its request ID on stderr (
import request … (reuse with --request-id to resume)). If the import is interrupted, run the same command again with--request-id IDand it resumes. A partially imported repository is never published. - The result reports
revisions,retained_originals(original Git objects kept for exact re-export),transformed,omitted,failed, importedtags(annotated tags with their tag object) andcertified_for_release: false. Imported history is never implicitly certified for release (15 §2). - Incremental import.
import-git ... --deltaimports the commits of--refafter the one the stream head was imported from. Each new commit becomes one stacked OPEN change (the first based on the stream head, each later one on the previous), submitted by the caller; its revision carries the commit's author, time and message. The stream head does not move: review, approvals, checks and integration follow the stream's normal policy. It needs stream administration on a repository bootstrapped from Git that is not archived, and it conflicts with--preflight-only. Re-running proposes only commits not yet proposed (an earlier one is reportedexisting), and the request id printed on stderr repeats an interrupted run exactly. Limits: the range must be a linear first-parent chain descending from the imported commit (DeltaNotLinearandDeltaBaseNotAncestorrefuse); a merge must be imported another way; native work that landed after the import makes the stream head unknown to the ref, which refuses; the delta's new content is held in memory while it is submitted; original Git objects of the delta are not retained.
3. Verify
Read the migration report. It lists what was retained, transformed, omitted or failed, with counts and identities (15 §5). The git-import-report runbook explains how to read it.
tjet-admin --issuer ISSUER --as SUBJECT import-report NAMEExport back to Git and compare. When nothing was omitted or transformed, the exported head commit ID equals the source head and
git fsck --strictpasses:tjet-admin --issuer ISSUER --as SUBJECT export-git NAME /tmp/check.git [--stream main | --rev REV] git -C /tmp/check.git rev-parse refs/heads/main git -C /tmp/check.git fsck --strictWhen anything was omitted or transformed (for example a default-omitted submodule, even one that exists only in history), the export rewrites the affected commits and all their descendants, so the head ID can differ even though the head's files are identical. Annotated tags on rewritten commits come out as plain refs. Compare trees and parents instead of commit IDs in that case. Retained original signatures do not authenticate rewritten commits.
Check the stored content.
tjet-admin --issuer ISSUER --as SUBJECT storage scrub NAME tjet-admin --issuer ISSUER --as SUBJECT storage reconcile NAME tjet-admin --issuer ISSUER --as SUBJECT doctor NAMECheck checkouts and permissions. Open representative sparse workspaces and run your builds (
tjet workspace open,tjet snapshot,tjet exec). Grant roles and check that each group sees exactly what it should (tjet repo grant; path rules through theaccess.putoperation).
The smoke script
tools/dev/git_import_smoke.sh runs the whole cycle on a bounded
private sample of a real repository against real FoundationDB (deploy/dev/fdb.cluster) and its
own temporary development tjetd. The cycle is import, report, export with head comparison and
fsck --strict, scrub, reconcile and doctor, then archive, delete, an operator purge-now
and a check that the repository is gone.
tools/dev/git_import_smoke.sh SOURCE_GIT_DIR COMMIT [OUT_JSON]
The script reads only COMMIT and its ancestors from the source, fetched into a private bare
sample. No hook or filter of the source runs. It prints one JSON summary with counts and
durations, and no file names or contents.
Verified (T069): run on 2026-10-19 against a 4-commit sample (merge, executable file,
symlink, annotated tag). Exit 0, export_head_matches: true, export_fsck: "strict ok",
scrub/reconcile/doctor ok, purge complete. Four segment files stayed in the store after the
purge, as D-153 expected at the time; since D-341 the purge deletes the repository's segment
files. The same sample imported into a long-running development installation
reported revisions: 4, retained_originals: 9, one retained annotated tag, and no omissions,
transformations or failures. See records/evidence/T069.json.
4. Cutover runbook (15 §5)
Never run two independently writable authorities for the same integration stream.
- Inventory and preflight (section 1). Classify every finding: accept the default, choose an option, or fix the source first.
- Stage the import into the new repository (section 2) and verify it (section 3): root and file identities, original mappings (the report and the export comparison), representative checkouts and builds, permissions.
- Freeze writes to the Git source, using the source system's own controls. trunkjet cannot freeze a foreign server.
- Import the final delta:
tjet-admin import-git NAME /path/to/source.git --delta [--ref R] [--stream S](section 2). The new commits arrive as stacked OPEN changes; review and land them under the stream's policy before you activate the new routing. A bootstrap import still refuses a stream that was already integrated. If the delta range is not linear (a merge after the imported commit), freeze the source before the bootstrap import, or delete the staged repository (archive, then staged delete; see the admin guide) and import again from the frozen source. - Fence the old authority. Keep the Git source read-only, never deleted, through your rollback retention period.
- Activate the new routing and workflows: client configuration (
tjet login, workspaces), CI validation submitters, webhooks, stream policies. - Record the cutover: the import request ID, the report and the export comparison.
5. Getting data out
| Path | Command | What you get |
|---|---|---|
| Native archive, complete (the vendor-independent exit path) | tjet-admin export-native REPO OUT, or tjet repo export NAME --output FILE | An NSCAR1 archive with source, changes, reviews, approvals and integration evidence, policies, locks, releases, audit references and object formats (15 §1), re-read and verified after writing. export-native needs read access to every path and audit read. tjet repo export downloads "everything you may read": a partial reader's archive is an authorized export, not a full backup |
| Restore an archive | tjet-admin restore ARCHIVE, or tjet repo import FILE | Exact restore into an isolated installation. See the restore-drill runbook |
| Git | tjet-admin export-git REPO OUT [--stream S | --rev R] [--empty-trees] [--sidecar PATH] | A new bare Git repository with exact file states, modes and symlinks. Unchanged imported history keeps its original objects. Native empty directories are left out and reported unless --empty-trees is given. Reviews and approvals are not Git data: they go into a sidecar bundle, <OUT>.nscm-sidecar.json by default (nscm-git-export-sidecar/1). It holds the native-revision-to-Git-commit mapping, the report items and the integration receipts with their evidence. It is unsigned, and an existing file is never overwritten |
A read-only Git projection served over smart HTTP (15 §4) is not implemented.
Import a whole project from GitHub or GitLab
tjet import brings a project with its history, issues (with comments, labels and milestones),
pull or merge requests (with their discussion), releases and wiki into a new repository. You need
to be an administrator of the organisation. In the web app: Repositories, then "Import a whole
project".
From GitHub. A public repository needs no token:
tjet import github octocat/hello-world --into acme/hello-world
Without a token GitHub answers 60 requests per hour. A project takes about 8 requests plus one per pull request (a repository with 10 pull requests: 18), so a big one waits for GitHub and takes hours; the import waits by itself. People are then not matched by their public address. A private repository, or a faster run, needs a fine-grained token with read-only access to Contents, Issues, Pull requests and Metadata:
export TJET_GITHUB_TOKEN=github_pat_...
tjet import github acme/private-widgets --into acme/widgets
We use the token for this run and do not keep it. The command never takes it as an argument, so it stays out of your shell history. If the import stops (rate limit, network, a restart of the server), run the same command again: it continues where it stopped and brings nothing in twice.
From a GitLab export (in GitLab: Settings, General, Advanced, Export project). No running GitLab is needed, so this also restores a project from an export you kept as a backup:
tjet import gitlab-export 2026-11-28_acme_widgets_export.tar.gz --into acme/widgets
We check the archive before anything is created: an archive with links, paths outside the archive, duplicate files or far more unpacked data than its size suggests is refused as a whole.
What you get:
- The default branch is the
mainstream, other branches are streams of the same name (/becomes-), the commits of each open pull request are the streampr-<number>, the wiki is the streamwiki. - Issues get new numbers. Each one starts with a line that names its number at the source, who
wrote it and when.
@nameand#12in imported text are shown as code, so nobody here is mentioned or notified by mistake. - Open pull requests become open changes. All pull requests, with comments, reviews and line
comments, are kept as history:
tjet import pulls acme/widgets. Releases:tjet import releases acme/widgets. - People: someone whose public GitHub address is a verified address of a member here is shown as
that member. Everyone else appears as
imported:@gh-login(orimported:@gl-login). After verifying the same address in their account, they runtjet import claim. Addresses inside a GitLab export are never linked automatically, because whoever made the file could have written any address. - Never imported: CI/CD variables and secrets, deploy keys, webhooks and their secrets, access
tokens. Also not yet: attachments, Git LFS objects, boards and snippets. The final report
(
tjet import status acme/widgets) lists everything that was left out.