# Native Membl Git (git.membl.io)

> **Availability notice:** Native Membl Git (`git.membl.io`), GitHub mirroring, and built-in code/PR browsing are currently paused for general self-serve in [app.membl.io](https://app.membl.io) while we focus on GitHub CI runners. [Contact us](/contact) if your team needs access.

Host repositories directly on **git.membl.io** alongside external Git forges when enabled for your workspace.

## Clone and push transports

Every native repository supports both Smart HTTP v2 and SSH on `git.membl.io`:

```bash
# HTTPS (Smart HTTP v2)
git clone https://git.membl.io/<org>/<repo>.git

# SSH (Ed25519, FIDO2 hardware keys, OpenSSH certificates)
git clone git@git.membl.io:<org>/<repo>.git
```

### Smart HTTP v2 authentication

* **Scoped Personal Access Tokens (`mbl_git_`)**: Mint least-privilege tokens under **Settings -> Connections -> Membl Git** (`/o/[tenant]/settings/git`) scoped to `repo:read`, `repo:write`, `pr:write`, or `lfs:write`. Tokens are SHA-256 hashed at rest and shown once on creation.
* **1Password `op://` references**: Every newly created PAT includes a ready-to-copy `op://` secret reference for local `op run` workflows and CI.
* **Job-bound OIDC**: Jobs running on Membl runners authenticate to `git.membl.io` with short-lived, job-scoped OIDC tokens without static deploy keys.

### SSH authentication

Register SSH public keys under **Settings -> Connections -> Membl Git**:

* **Ed25519 (`ssh-ed25519`)** and **FIDO2 hardware keys (`sk-ssh-ed25519@openssh.com`)**
* **OpenSSH user certificates** for short-lived org-issued credentials
* Verify connectivity anytime with `ssh -T git@git.membl.io`.

## Real-time GitHub mirroring and 1-click organization sync

From **Projects -> Import / Mirror** or **Settings -> Connections -> Membl Git**, open the **Mirror from GitHub** tab (or switch to **Any Git URL** for GitLab, Gitea, Forgejo, Bitbucket, or Generic Git):

* **Pull Mirror (`GitHub -> git.membl.io`)**: Synchronizes branches, tags, and optional pull request refs (`refs/pull/*/head`) within seconds on verified GitHub App `push`, `create`, `delete`, and `pull_request` webhooks, backed by an automatic 15-minute drift sweep. Pre-receive protection blocks accidental direct pushes while pull mirroring is active so upstream history stays clean.
* **Push Mirror (`git.membl.io -> GitHub`)**: Use `git.membl.io` as your primary Git server and automatically replicate updated branches and tags upstream to GitHub after every push.
* **1-click Organization Mirroring**: Toggle **Mirror entire GitHub organization (including future repos)** to batch-provision mirrors for every connected repository in your GitHub organization and automatically mirror newly created repositories when GitHub fires `repository.created`.
* **Zero-PAT GitHub App authentication**: Connected private GitHub repositories authenticate with short-lived, repository-scoped GitHub App installation tokens minted in memory (`contents:read` for pull mirrors and `contents:write` only for push mirror replication), requiring zero personal access tokens and zero manual secret configuration. External HTTPS URLs continue to support 1Password `op://` secret references.
* **One-time Import**: Clone all branches, tags, and commit history once into a standalone native repository on `git.membl.io`.

## $0 auto-accelerated CI checkouts & performance architecture

* **Auto-accelerated mirrored CI checkouts (`$0` egress)**: When a Membl CI job runs for a mirrored GitHub repository and the target commit SHA is already present in `git.membl.io`, runners hydrate the workspace from internal `bundle-uri` and Ref-CAS storage (`$0.00` internal egress), with transparent fallback to `github.com` if a brand-new commit is still syncing.
* **Protocol-v2 `bundle-uri` offload**: Initial clones and CI fetches advertise pre-built Git bundles so large monorepos clone fast without overloading pack negotiation.
* **Git LFS Direct-to-S3 Batch API**: Large binary assets upload and download directly via presigned Batch API endpoints with SHA-256 content verification.
* **Direct internal CI dispatch**: Direct pushes to `git.membl.io` trigger `.membl/workflows/*.yml` inside Membl without external webhook hops.

## 1-click outage failover (Promote to Primary)

Every mirrored repository includes a live **Mirror status** bar in the Code Browser (`/code`) showing the upstream GitHub link, mirror mode badge, last synced timestamp and HEAD SHA, **Sync now**, and **Pause / Resume** controls:

1. **Automatic GitHub incident awareness**: When `githubstatus.com` reports active degradation across Git Operations, Webhooks, Pull Requests, API Requests, or Actions, Membl highlights **Promote to Primary** directly on your pull mirror.
2. **Instant failover**: Clicking **Promote to Primary** unlocks direct `git push` to `git@git.membl.io:<org>/<repo>.git` immediately and pauses upstream GitHub fetches so engineers keep pushing, reviewing, and running `.membl/` CI without downtime.
3. **Clean recovery**: Once GitHub recovers, click **Replicate back to GitHub (Switch to Push Mirror)** to push commits landed on `git.membl.io` during the incident back to GitHub.

## Code browser, pull requests, and review

Native Membl Git repositories include a built-in code and review workspace inside your project:

* **Code Browser (`/code`)**: Collapsible file tree, branch/tag/SHA ref switcher, `t` fuzzy file finder, `#L42-L58` line-range anchors, toggleable Blame view, and **Ask Membl** file context injection.
* **Commits (`/commits`)**: Full commit history with Verified **SSH**, **GPG**, and **ML-DSA** commit signature badges and linked CI check status.
* **Unified and Split PR Diffs (`/pulls/[n]`)**: Toggle Unified or Split layout, ignore whitespace, track **Viewed** files in the file-tree rail, collapse large diffs (`>500` lines) on demand, and navigate hunks with `j`/`k` and `c` to comment.
* **Inline threads and 1-click suggestions**: Anchor comments to exact lines and commit SHAs, insert fenced ` ```suggestion ` blocks, and commit accepted fixes directly from the PR with one click.
* **Stacked PRs**: Automatic parent/child stack breadcrumbs when a PR targets another feature branch (`base_ref != default_branch`), with restack indicators and merge-train visibility.
* **Live `.membl/` checks, merge box, and Ask Membl AI Review**: Watch workflow checks live, merge via Squash (default), Merge commit, or Rebase (with optional auto-merge once required checks pass), or run **Ask Membl AI Review** directly on the diff.
* **Branch Rulesets**: Configure per-repository rules in Project Settings to block force-pushes and branch deletions, require `.membl/` status checks, set optional approvals, require signed commits, and block committed secrets.

## Pricing

Every Membl workspace includes Native Git and LFS storage and egress on every plan:

| Resource                         | Included monthly allowance | Overage rate         |
| -------------------------------- | -------------------------- | -------------------- |
| **Git + LFS storage**            | **10 GB**                  | **$0.15 / GB-month** |
| **External Git & LFS egress**    | **100 GB / month**         | **$0.10 / GB**       |
| **Internal Membl runner clones** | **Unlimited**              | **$0.00**            |

Internal clones, fetches, and `bundle-uri` transfers to managed Membl runners are always `$0`. Track current storage and egress meters under **Settings -> Billing and usage** when Native Git is enabled for your workspace.

