---
title: "Rotate"
description: "Replace secrets after a leak, on this machine, in production or for the whole project, and how other machines pick up the new ones."
canonical_url: "https://extraorbital.dev/docs/rotate"
last_updated: "2026-12-04"
---

# Rotate

> Replace secrets after a leak, on this machine, in production or for the whole project, and how other machines pick up the new ones.

<Callout title="In brief">

- `npx extraorbital rotate` replaces this machine's secrets and rewrites `.env`.
- `npx extraorbital rotate remote vercel` does the same for production, and pushes the new values.
- `npx extraorbital rotate --all` replaces every secret of the project (admins and owners).
- The old secrets keep working for a grace period (24 hours by default, `--grace`), so nothing breaks while the new ones spread.

</Callout>

## Rotate after a leak

Rotate on the machine whose `.env` may have leaked, in the project's folder:

```sh
npx extraorbital rotate --dry-run           # what would change
npx extraorbital rotate                     # every resource in .env, this machine's credentials
npx extraorbital rotate neon/db --grace 24h # one resource; the old secret works 24h more
```

`rotate` replaces this machine's own credential on each resource and rewrites its block in `.env`, printing only the variable names. Credentials other machines and destinations hold are untouched. A resource where this machine reads the shared primary is skipped and named: `rotate <resource>` rotates it, for every machine that shares it.

## Rotate production

```sh
npx extraorbital rotate remote vercel                          # production
npx extraorbital rotate remote vercel:acme-web:preview         # preview, by its remote name
npx extraorbital rotate remote acme/web                        # a keyless app: what it holds is revoked
```

`rotate remote` mints new credentials for the destination and pushes them there at once; the previous ones stop after 24 hours, or after `--grace`. A keyless app needs nothing pushed: its credentials are revoked, and it fetches new ones on its next request.

## Rotate everything

After a leak you can't pin down, or when someone leaves the team, an admin or owner replaces every credential of the project in one go, from the folder linked to it:

```sh
npx extraorbital rotate --all --dry-run       # what would change, nothing changed
npx extraorbital rotate --all --grace 24h     # every machine, production, keyless apps
```

```txt
✓ Rotated 8 credentials of web, revoked 1, 1 pushed credential retiring
  neon/db · machine ada-laptop · rotated
  neon/db · machine bob-desktop · rotated
  neon/db · shared primary · rotated
  neon/db · keyless acme/web · revoked
  …
✓ Pushed new credentials to vercel:acme-web:production
  Other machines put their new secrets in .env by themselves, on their next extraorbital command
```

Every machine's own credential and the shared primary are rotated. Each machine gets the new secret in its `.env` on its next command, and yours gets it at once. Keyless apps have what they hold revoked and fetch new credentials on their next request. The Vercel project the folder is linked to is pushed to again. Any other destination keeps its old credential for the grace (24 hours by default) and is named, with the command to push to it before then. A sensitive resource is skipped and named: `rotate <resource>` rotates it with its password.

A member who runs `rotate --all` is refused. Members rotate their own machines' credentials with `rotate`.

## What other machines see after a rotation

When someone else rotates a credential a machine reads (an admin's `rotate --all`, the dashboard, another folder of yours), that machine needs nothing done by hand. The next `extraorbital` command it runs in the project's folder notices that the secret in `.env` no longer matches and rewrites the block:

```txt
↻ neon/db was rotated elsewhere: its new secret is in .env now
```

It checks at most every ten minutes per folder. A sensitive resource's secret takes its password, so `.env` is left alone and the line says so: `extraorbital run <resource> -- <command>` uses the new secret. Set `EXTRAORBITAL_NO_ENV_REFRESH=1` to turn the check off.

## Next

- [Push to your hosting provider](/docs/push): where the variables go, and what reads them.

---

More for agents: [Sitemap](https://extraorbital.dev/sitemap.md) · [llms.txt](https://extraorbital.dev/llms.txt) · [agents.md](https://extraorbital.dev/agents.md)
