← All posts
2 min readThe nvault team

Finding the right project from your Git remote

nvault init should know which environment to restore without being told. It does that by reading your Git remote — deterministically, and never silently.

clideveloper-experience

You have just cloned a repo onto a new machine. You want its environment files back. The CLI should not make you remember or type a project name — it should look at where you are and figure it out.

How detection works

nvault init reads the Git remote of the current directory, normalises it, and asks the API whether a project is associated with that remote.

$ cd portfolio-analytics
$ nvault init

Git repository:   github.com/acme/portfolio-analytics
Matching project: portfolio-analytics

Restore 3 files into this directory?
  .env  .env.local  .env.production

Normalisation matters: git@github.com:acme/portfolio-analytics.git and https://github.com/acme/portfolio-analytics and the same URL with a trailing slash all resolve to one canonical form before the lookup.

Deterministic and explainable

Two properties we care about:

  • Deterministic — the same directory always resolves to the same project. No fuzzy matching on folder names, no guessing.
  • Explainable — the CLI prints which remote it read and which project it matched, before doing anything. If that mapping is wrong, you see it immediately.

Git is a convenience, not a requirement

Plenty of real situations have no usable remote: a repo that has not been pushed, a monorepo with several deployable apps, a directory that is not a Git repo at all. In all of those you can select the project explicitly — nvault pull <project> — and the CLI gets out of the way. Detection is there to save you typing when it can, not to be the only path.

Stable identifiers underneath

The remote is a lookup key, not the project's identity. Projects have stable, non-guessable internal identifiers, so you can rename a repo, move it between hosts, or change the remote URL without losing the link — you just re-associate the new remote.
Good automation tells you what it decided and why, then lets you override it.

The goal is that nvault init becomes the fastest way to bring a project's environment back on a machine that has never seen it.

Your development environment, available anywhere.

Create a vault, push your first project, and restore it anywhere.

Related reading