Cursor Origin
Origin CloneKit: Faster Clones in CI
origin repo clone-fast replaces git clone in CI jobs. It downloads a prebuilt clone kit, a packed snapshot Cursor builds for each repository with CloneKit turned on, then fetches only the objects added since the kit was built. CloneKit is available on Enterprise plans and is turned on per repository, and the job needs a short-lived Origin token in CURSOR_AUTH_TOKEN.

On this page
What does origin repo clone-fast do differently from git clone?
git clone clones from scratch. origin repo clone-fast {owner}/{repo} [DIR] starts from a clone kit instead: a packed snapshot of the repository that Cursor builds ahead of time. Each run downloads the kit, installs it into an empty directory, and then catches up on whatever changed since the kit was built.
- 1Fetch the kit manifest from Origin using the token in
CURSOR_AUTH_TOKEN. The manifest lists the kit's artifacts and the commit at its tip. - 2Download the pack artifacts from
gitcdn.origin.cursor.comand check their sizes. With--verify, the hashes are checked while the download runs. - 3Install the artifacts into the destination directory, which must be empty.
- 4Top up the clone: fetch the objects added since the kit was built and check out the current tip of the default branch.
A kit is a snapshot, so on its own it sits at the commit it was built from. The top-up fetches the newer objects and moves the checkout to the default branch tip. Two flags change that last step: --no-top-up leaves the checkout at the kit's tip, and --bare creates a bare repository with no working tree.
When the kit path succeeds, the command prints mode: clone-kit on stdout. If any step fails, the default --fallback auto runs a plain git clone and prints mode: git-clone. With --fallback never, the command exits with status 1 instead. Under the default, a pipeline can stay green without ever using the kit, so run the first job with --fallback never, as the last section explains.
The clone ends on the default branch tip. A job that builds a specific commit has to fetch and check it out afterwards, with git fetch origin SHA and git checkout SHA. Origin serves any reachable commit by SHA.
This is covered hands-on in Cursor Compile 2026 — 1 short Unit, free to read.
Rather do it than read about it? Run 11 interactive Cursor walkthroughs in a simulated editor. Free, no account needed.
What do you need before turning CloneKit on?
CloneKit is available on Enterprise plans and is turned on per repository. There is no self-serve toggle, so start by contacting your Cursor account team about each repository you clone. Run origin repo clone-fast --help to list the command's options.
The runner needs the Origin CLI, installed with curl -fsSL https://downloads.cursor.com/origin/install.sh | sh, which puts the binary at $HOME/.local/bin/origin. Linux runners need glibc on x64 or arm64, and macOS runners are supported. Alpine and other musl images are not supported. The runner also needs bash, git, jq, curl 7.55 or later and openssl 1.1.1 or later. clone-fast uses curl for its downloads.
Network egress has to reach four hosts, and each one serves a different part of the job.
- Host
downloads.cursor.com- Used for
- Installing the CLI
- Host
origin.cursor.com- Used for
- The kit manifest and git operations
- Host
gitcdn.origin.cursor.com- Used for
- Kit downloads
- Host
api.cursor.com- Used for
- Minting tokens and mirror sync requests from an Origin App
| Host | Used for |
|---|---|
downloads.cursor.com | Installing the CLI |
origin.cursor.com | The kit manifest and git operations |
gitcdn.origin.cursor.com | Kit downloads |
api.cursor.com | Minting tokens and mirror sync requests from an Origin App |
Egress hosts listed in the CloneKit CI docs.
How does the token get onto the runner?
Every CI system ends up in the same place: a short-lived token exported as CURSOR_AUTH_TOKEN in the shell that runs origin. What differs is who mints it. Buildkite does it for you through its Agent API. GitHub Actions, GitLab CI, Jenkins, CircleCI and self-hosted fleets mint their own through an Origin App.
- CI system
- Buildkite (hosted or self-hosted), with Origin connected as the repository provider
- Where the token comes from
- The Buildkite Agent API, in a
checkouthook
- CI system
- GitHub Actions
- Where the token comes from
- Your Origin App, in a workflow step
- CI system
- GitLab CI, Jenkins, CircleCI, self-hosted fleets
- Where the token comes from
- Your Origin App, in the job
| CI system | Where the token comes from |
|---|---|
| Buildkite (hosted or self-hosted), with Origin connected as the repository provider | The Buildkite Agent API, in a checkout hook |
| GitHub Actions | Your Origin App, in a workflow step |
| GitLab CI, Jenkins, CircleCI, self-hosted fleets | Your Origin App, in the job |
Where each CI system gets its token, from the CloneKit CI docs.
On every CI system, tokens last at most 15 minutes and cannot be refreshed, so you mint one immediately before the clone. A later job, or a git operation more than 15 minutes after the mint, needs a fresh token, minted the same way.
Outside Buildkite, you create an Origin App once and install it on the repositories you clone. Each job gets the private key as ORIGIN_APP_PRIVATE_KEY, plus two plain variables, ORIGIN_APP_ID and ORIGIN_INSTALLATION_ID. The job signs an app JWT and exchanges it for an installation token that asks for repository:contents:read, which covers clone, fetch and pull. Push needs repository:contents:write, and the installation must have granted it.
The App JWT reference suggests a lifetime of about five minutes, but an installation token never outlives the JWT that minted it. So the recipe signs a 15-minute JWT, and the token gets its full 15 minutes. The recipe also feeds the private key to openssl through a file descriptor and the bearer header to curl through stdin. Neither shows up on a command line, where other processes on the runner could read it.
origin_app_token origin repo clone-fast acme/widgets . --verify origin auth setup-git git fetch origin "$COMMIT_SHA" git checkout -q "$COMMIT_SHA"
How does Buildkite supply the token?
On Buildkite, you replace the agent's default checkout with a checkout hook. The hook requests a token from the Buildkite Agent API, scoped to the pipeline's repository, and exports it. It runs origin repo clone-fast with --verify, registers the credential helper with origin auth setup-git, and checks out $BUILDKITE_COMMIT. The hook can't live in the repository itself, because the repository is not checked out yet when the hook runs.
You must be a Buildkite organization administrator to connect Origin, and an Origin administrator to install the Buildkite app.
Three details decide whether the hook works. The repo_url you send must match the URL registered on the pipeline exactly, .git included, or the Agent API returns HTTP 400, so send $BUILDKITE_REPO unchanged. If the Agent API answers HTTP 503, wait for its Retry-After header and retry. If the agent keeps its build directory between builds, empty $BUILDKITE_BUILD_CHECKOUT_PATH before the hook runs, because clone-fast falls back to git clone when it finds files there.
How do you run CloneKit in GitHub Actions?
GitHub Actions uses the Origin App path, with one extra step caused by where the code lives. The repository is on GitHub and Origin holds it as a mirror, so the workflow first asks Origin to pull the build's commit, then clones. It never calls GitHub, so it needs no GITHUB_TOKEN permissions and doesn't use actions/checkout.
- 1On the app's page in Origin app settings, select Sync mirrors from upstream (
repository:mirror:sync) under Permissions. If the app is already installed, open the installation's page and select Review & Update. - 2In your repository, go to Settings > Secrets and variables > Actions and add the secret
ORIGIN_APP_PRIVATE_KEYwith the full private key PEM. - 3On the same page, add the repository variables
ORIGIN_APP_IDandORIGIN_INSTALLATION_ID. - 4Save the workflow as
.github/workflows/ci.yml, setORIGIN_REPOto the mirror's{owner}/{repo}on Origin, and add your build steps after the clone step.
The workflow installs the CLI, mints a token, calls Sync Mirror with "wait":true, then clones and checks out the build's commit. On a pull_request event, github.sha is a merge commit that exists only on GitHub, so the workflow builds the pull request's head commit and branch instead. Pull requests from forks are not mirrored at all, because their head branch is not in your repository, so build those from GitHub.
Sync Mirror is its own API call. It accepts the installation token and needs repository:mirror:sync. It returns 200 with "synced": true, or 202 with "synced": false once its wait budget of about two minutes runs out. The workflow treats any response without "synced": true as a failure and exits 1.
If Origin is the source of truth and GitHub is the mirror, delete the sync request. The commit is already on Origin, and Origin rejects sync requests for repositories that do not pull from an upstream source.
The workflow also masks both the app JWT and the installation token with ::add-mask::, which hides them in the job log. As in the generic recipe, the token never goes to a file. A later step that needs Origin git access mints again instead of reading the token from $GITHUB_ENV or $GITHUB_OUTPUT, which are files on disk.
How do you verify the first run and read the errors?
Run the first job with --fallback never. A missing kit then fails the job with exit status 1 instead of quietly running a slow git clone. Keep the flag on until the kit path succeeds. A good run prints clone-kit: manifest=..., one download line per artifact, a clone-kit timings: block and clone-kit: ready DIR (head SHA) on stderr. It then prints mode: clone-kit on stdout and exits 0.
The timings block splits the run into manifest, download, verify and checkout phases. To measure the gain, compare its total with a plain git clone of the same repository on the same runner. The docs publish no figure for the gain.
When the kit path doesn't finish, stderr carries one machine-readable line, clone-kit-result: status=fallback phase=PHASE or clone-kit-result: status=failed phase=PHASE, followed by the reason. The phase and the message after it point to the cause.
- Log line
phase=manifestwithHTTP 404- Cause
- No clone kit exists for the repository yet, or the command received a clone URL (
https://twice in the message) instead of{owner}/{repo} - Fix
- Ask your Cursor account team to turn CloneKit on, or pass
{owner}/{repo}
- Log line
manifest fetch failed: HTTP 401- Cause
- Origin rejected the token: expired, never valid, or its installation was removed
- Fix
- Mint a new token immediately before the clone
- Log line
manifest fetch failed: HTTP 403- Cause
- The installation or Buildkite pipeline token does not cover this repository
- Fix
- Reinstall the app or reselect its repositories
- Log line
phase=authwithNot authenticated- Cause
CURSOR_AUTH_TOKENis not exported into the process that runsorigin- Fix
- Export it in the same shell
- Log line
could not read Username for 'https://origin.cursor.com'- Cause
- The CLI is out of date, or the token is not exported where
gitruns - Fix
- Run
origin update, or export the variable
- Log line
401withIssuer is not authorized- Cause
- The
issclaim is not a registered App ID, or the signing key is not registered on that app - Fix
- Confirm
ORIGIN_APP_IDmatches and the app lists the signing key
| Log line | Cause | Fix |
|---|---|---|
phase=manifest with HTTP 404 | No clone kit exists for the repository yet, or the command received a clone URL (https:// twice in the message) instead of {owner}/{repo} | Ask your Cursor account team to turn CloneKit on, or pass {owner}/{repo} |
manifest fetch failed: HTTP 401 | Origin rejected the token: expired, never valid, or its installation was removed | Mint a new token immediately before the clone |
manifest fetch failed: HTTP 403 | The installation or Buildkite pipeline token does not cover this repository | Reinstall the app or reselect its repositories |
phase=auth with Not authenticated | CURSOR_AUTH_TOKEN is not exported into the process that runs origin | Export it in the same shell |
could not read Username for 'https://origin.cursor.com' | The CLI is out of date, or the token is not exported where git runs | Run origin update, or export the variable |
401 with Issuer is not authorized | The iss claim is not a registered App ID, or the signing key is not registered on that app | Confirm ORIGIN_APP_ID matches and the app lists the signing key |
On 401 and 403, the fallback git clone fails with the same code and exit status 128, so the log shows both errors.
origin auth status can report a valid token while the clone still fails. It derives Token: valid or Token: expired from the expiry claim inside CURSOR_AUTH_TOKEN and never asks Origin whether the token is accepted, so valid means only that the token has not expired. The CLI also treats a token as expired five minutes before its expiry claim and refuses to make requests with it. That is how clone-fast ends up logging phase=auth with an expired-session message. Mint a new token and retry.
If the kit path still fails after all of this, send your account team the job log with the clone-kit-result line, the repository and the output of origin --version.
Frequently asked questions
Who can use origin repo clone-fast?
CloneKit is available on Enterprise plans and is turned on per repository. There is no self-serve toggle, so you contact your Cursor account team to turn it on for each repository you clone.
What happens if the clone kit is missing or a step fails?
With the default fallback setting, auto, the command runs a plain git clone and prints mode: git-clone. With the fallback set to never, it exits with status 1 instead. The docs suggest running the first job with the fallback set to never, so a missing kit fails the job instead of silently running a slow clone.
How long does the Origin token last?
At most 15 minutes, and it cannot be refreshed. Mint it immediately before the clone, and mint again for any later job or any git operation more than 15 minutes after the mint.
Does CloneKit work with GitHub Actions?
Yes. The workflow mints a token through an Origin App, asks Origin to pull the build's commit from GitHub into its mirror, then clones from Origin. It never calls GitHub, so it needs no GITHUB_TOKEN permissions and doesn't use actions/checkout.
Sources & last verified
- Cursor docs: CloneKit in CI
- Cursor docs: Install the Origin CLI
- Cursor docs: Build an Origin App
- Cursor docs: Mirror from GitHub
- Cursor API: App JWT
- Cursor API: Create Installation Access Token
- Cursor API: Sync Mirror
Cursor ships frequently. Facts verified against primary sources on October 28, 2026.