> ## Documentation Index
> Fetch the complete documentation index at: https://docs.entire.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Mirror Repositories in the CLI

> Create GitHub repository mirrors with the Entire CLI and configure Git remotes.

You can inspect and mirror repositories in the Entire CLI as easily as you would on entire.io.

## Before You Start

Make sure you have:

* [Entire installed](/installation)
* access to clone the GitHub repository you want to mirror
* the [Entire GitHub App authorized](/guides/repositories/github-app-access) for the repository

Each selected region creates a separate mirror placement. If you select several regions, choose the placement closest to your agents when you clone or configure a remote. [Mirror access follows GitHub collaborator permissions](/guides/repositories/mirror-access-and-permissions).

Read [What Mirrors Do Not Do](/guides/repositories/mirrors#what-mirrors-do-not-do) before setup if the repository uses Git LFS. Branches under `entire/unmirrored/` stay in one Entire region and do not sync to GitHub.

## Log In

Log in with the Entire CLI:

```bash theme={null}
entire login
```

Confirm that your login is active:

```bash theme={null}
entire auth status
```

## Inspect Repositories and Mirrors

List repositories that your login can access:

```bash theme={null}
entire repo mirror list
```

The list combines existing mirrors with GitHub repositories you can onboard. Use `--mirrored` to show existing mirrors or `--available` to show GitHub repositories that do not have a mirror placement yet.

Inspect one repository and its placement on each cluster:

```bash theme={null}
entire repo view /gh/OWNER/REPO
```

The view shows the repository's name and visibility, then one row per cluster with its role, clone URL, and status, such as `ready`, `processing`, or `failed`.

## Create the Mirror

Run the add command with no arguments:

```bash theme={null}
entire repo mirror add
```

Entire prompts you to select repositories and regions. It creates a placement for every selected repository in every selected region:

```text theme={null}
Select repos to mirror
Space to select, enter to confirm.

> [•] <owner>/<repo>

Select regions to mirror into
Each repo is mirrored into every selected region.

> [•] us-east (us)
  [•] eu-west (eu)

REPO            REGION        STATUS  CLONE URL
<owner>/<repo>  us-east (us)  ready   entire://aws-us-east-2.entire.io/gh/<owner>/<repo>
<owner>/<repo>  eu-west (eu)  ready   entire://aws-eu-central-1.entire.io/gh/<owner>/<repo>
```

This registers the mirror placements on Entire. It does not change any local Git checkout.

### Script the Mirror Creation

To create one placement without repository prompts, pass the repository and, optionally, its cluster host:

```bash theme={null}
export GH_OWNER="<owner>"
export GH_REPO="<repo>"

entire repo mirror add "/gh/$GH_OWNER/$GH_REPO" --cluster aws-us-east-2.entire.io
```

Write the repository as a `/gh/OWNER/REPO` reference. A bare `owner/repo` and a GitHub URL are both refused, with a message telling you the `/gh/` spelling to use instead. If you omit `--cluster`, an interactive terminal offers the available clusters as a multi-select. A non-interactive run defaults to `aws-us-east-2.entire.io`. For several regions at once, repeat `--cluster` or comma-separate the hosts.

The command waits until the initial clone from GitHub is available, then prints a table of repository, region, status, and clone URL, followed by the `git clone` command for it.

Creating a mirror is idempotent for a given repository and region: rerunning the command returns the existing mirror. To return as soon as the mirror is registered instead of waiting for the initial clone, pass `--no-wait`.

## Clone the Mirror

Clone by repository path:

```bash theme={null}
entire repo clone "/gh/$GH_OWNER/$GH_REPO"
```

If the repository has one placement, Entire selects it. If it has placements on several clusters, an interactive terminal prompts you to choose one. Without a terminal, a GitHub mirror falls back to `aws-us-east-2.entire.io` and errors if it is not placed there. Select a cluster explicitly with `--cluster`:

```bash theme={null}
entire repo clone "/gh/$GH_OWNER/$GH_REPO" --cluster aws-eu-central-1.entire.io
```

You can also pass a full `entire://` URL. Because the URL already names a cluster, Entire passes it to `git clone` without a placement lookup.

## Use the Mirror in an Existing Checkout

From the existing GitHub checkout, run:

```bash theme={null}
cd "$GH_REPO"
entire repo remote add entire
```

Entire resolves the repository from the checkout's existing remotes. If it has placements on several clusters, an interactive terminal prompts you to choose one, and a run without a terminal uses the repository's own cluster. Pass `--cluster` to choose either way.

This adds `entire` alongside `origin` and leaves `origin` on GitHub. To send everyday Git commands through the mirror, repoint `origin` instead:

```bash theme={null}
entire repo remote add origin --override
```

A name that already exists is refused unless you pass `--override`, the same way `git remote add` behaves. With `--override`, Entire prints the URL it replaced, credentials redacted, and that printout is the only record of it.

This command only edits the current checkout's Git configuration. The server-side mirror must already exist.

## Push through the Mirror

Push through the mirror remote with normal Git commands:

```bash theme={null}
git push -u entire <branch>
```

Use `origin` instead if you repointed it with `--override`.

Entire forwards the push through the mirror to the upstream GitHub repository. Your GitHub write access, branch protection rules, and required checks still apply.

## Push an Unmirrored Branch

Branches whose names start with `entire/unmirrored/` are never forwarded to GitHub. The branch stays in the mirror's Entire region, so pushes to it are not subject to GitHub's push rate limits. See [Entire-Native Branches](/guides/repositories/entire-native-branches) for when to use them.

Create and push an unmirrored branch with normal Git commands:

```bash theme={null}
git switch -c "entire/unmirrored/<branch>"
git push -u entire "entire/unmirrored/<branch>"
```

Push it to the Entire remote, not to GitHub. The prefix only does anything on an `entire://` remote.

When you want the work on GitHub, push the same commits to a branch name outside the prefix:

```bash theme={null}
git push entire "entire/unmirrored/<branch>:<branch>"
```

> [!WARNING]
>
> Entire does not currently back up unmirrored branches, and they are not available on GitHub or from mirrors in other regions. Keep a copy of any work you cannot afford to lose on a mirrored branch or on GitHub.

## Raw Git Fallback

Use raw Git commands when you need to manage the remote configuration yourself. Git invokes `git-remote-entire` for `entire://` remotes.

Clone from a known placement URL:

```bash theme={null}
git clone "entire://aws-us-east-2.entire.io/gh/$GH_OWNER/$GH_REPO"
```

To repoint `origin`:

```bash theme={null}
git remote set-url origin "entire://aws-us-east-2.entire.io/gh/$GH_OWNER/$GH_REPO"
```

To keep `origin` and add a separate remote:

```bash theme={null}
git remote add entire "entire://aws-us-east-2.entire.io/gh/$GH_OWNER/$GH_REPO"
```

With raw Git, save the previous URL and select the regional placement yourself. See [Troubleshooting](/guides/repositories/troubleshooting) for `git-remote-entire` diagnostics.

## Remove the Mirror

When you no longer need the mirror, remove the server-side mirror placement:

```bash theme={null}
entire repo mirror remove "/gh/$GH_OWNER/$GH_REPO"
```

On a terminal Entire offers the clusters the repository is mirrored on as a multi-select, with nothing pre-selected. There is no default, so a non-interactive run must name them with `--cluster`.

Removing a mirror does not delete or rewrite the GitHub repository. It also does not change any local Git remotes you configured in `.git/config`.

## Continue With

> **[Mirror a GitHub Repository](/learn/mirror-a-github-repository)**
>
> Follow the end-to-end tutorial for creating, cloning, pushing through, and restoring a mirror.

> **[Mirrors in entire.io](/guides/repositories/mirrors-in-entire-io)**
>
> Configure GitHub access and choose repositories from the web interface.

> **[Mirror Access and Permissions](/guides/repositories/mirror-access-and-permissions)**
>
> Understand GitHub-synced access, hourly collaborator sync, and offboarding.

> **[Troubleshooting](/guides/repositories/troubleshooting)**
>
> Fix missing repositories, app access, clone, fetch, and push issues.
