crab README

The project's README from github.com/crabbuild/crab. As one markdown file: README.md.

Crab logo

Crab

Serverless Git for large files.

CI status Latest release Apache 2.0 license

Website · Documentation · Crab vs. Git LFS

Crab keeps models, datasets, media, game assets, and build artifacts out of ordinary Git blobs. Git stores small pointer files while Crab stores the original content as deduplicated chunks in object storage you control.

In direct-storage mode, each developer connects to Amazon S3, Google Cloud Storage, Azure Blob Storage, or an S3-compatible bucket. There is no Crab data server or database to deploy.

Install Crab

Install the latest release on macOS or Linux with Homebrew:

brew install crabbuild/tap/crab

You can also use the checksum-verifying installer on macOS or Linux:

curl -fsSL https://crab.build/install.sh | bash

On Windows, run the PowerShell installer:

irm https://crab.build/install.ps1 | iex

Verify that Crab and its Git remote helper are available:

crab version
crab --help

The release includes crab, git-remote-crab, and the available mount helpers. The shell installer supports CRAB_VERSION for release pinning and CRAB_INSTALL_DIR for a custom destination. See the installation guide for platform details.

If you work with several Crab repositories, register the Git drivers once with crab install --global. crab configure and crab clone configure the current repository automatically.

Create and ship a repository

Start with a directory, a cloud bucket, and credentials that can write to it:

mkdir my-project
cd my-project

crab configure s3://my-bucket/my-project
crab ship . -m "Initial commit"

crab configure selects the storage provider, discovers credentials, initializes Git, installs the filter driver, and detects large files. crab ship stages, commits, and pushes in one command.

Use the same flow with Google Cloud Storage or Azure Blob Storage:

crab configure gs://my-bucket/my-project
crab configure azure://my-container/my-project

Pass explicit tracking rules when you do not want automatic detection:

crab configure s3://my-bucket/my-project --no-auto-track
crab track '*.safetensors'
crab track 'datasets/**'
crab ship . -m "Track model and dataset files"

For separate Git steps, use Crab for large-file staging, then push through Crab's concurrent pipeline:

crab add .
git commit -m "Add project data"
crab push

A normal git push also works because Git invokes git-remote-crab for a crab:// remote.

Preview a large operation with crab ship . --dry-run -m "Preview".

Why Crab

How Crab works

Crab integrates with Git at two boundaries:

  1. The filter driver converts files selected by .gitattributes into small pointer blobs and stages their content locally.
  2. The git-remote-crab helper transfers Git objects, refs, and Crab-managed content for crab:// remotes.
working tree ── clean/smudge filter ── pointer blobs ── Git history
                       │
                       └── deduplicated chunks ── object storage

When you push, Crab uploads immutable chunks and reconstruction metadata before it publishes mutable ref state. When you hydrate, Crab verifies the chunks and reconstructs the original bytes.

Supported storage backends

Crab accepts provider-prefixed URLs during setup, then records a canonical crab:// Git remote:

Backend Configure with Common credential sources
Amazon S3 crab configure s3://bucket/repository AWS shared profiles/SSO, web identity, ECS or EC2 role, access-key environment variables
S3-compatible storage crab configure crab://bucket/repository --provider s3 Access-key environment variables and AWS_ENDPOINT_URL
Google Cloud Storage crab configure gs://bucket/repository Application Default Credentials or GOOGLE_APPLICATION_CREDENTIALS
Azure Blob Storage crab configure azure://container/repository Workload or managed identity, connection string, account key, Shared Access Signature (SAS) credentials

Never commit cloud credentials or place secret values in crab.toml. Read the authentication guide for provider-specific setup.

Build from source

Clone the workspace and use its supported installer:

git clone https://github.com/crabbuild/crab.git
cd crab/crab
make install

This builds the CLI, Git remote helper, and platform mount helpers. Filesystem in Userspace (FUSE) and Network File System (NFS) builds may require operating-system development packages.

Clone and hydrate

Lazy clone

By default, Crab clones Git history and checks out pointer files without downloading every large payload:

crab clone crab://my-bucket/my-project
cd my-project

# Inspect pointer/hydration state.
crab status

# Materialize only what this workspace needs.
crab hydrate '*.safetensors'
crab hydrate 'datasets/validation/**'

Hydrate everything when the job needs a complete working tree:

crab hydrate --all

Hydration can also use a newline-delimited manifest, a manifest stored in a Git ref, or a named profile in crab.toml:

crab hydrate --manifest .crab/manifests/ci.txt
git ls-files '*.rs' | crab hydrate --manifest -
crab hydrate --profile=ci

Reclaim disk space

crab dehydrate replaces clean, verified full files with their pointer blobs. It never replaces a dirty file with a stale pointer:

crab dehydrate '*.safetensors'
crab dehydrate --all

# Explicitly include protected profile files when reclaiming all space.
crab dehydrate --all --ignore-profiles

Use crab fetch to pre-warm the local cache without changing the working tree:

crab fetch --include '*.safetensors'
crab cache stats
crab cache clean

Lazy checkout is a Crab pointer-materialization feature, not Git partial clone. The wrapper does not request --filter=blob:none; ordinary Git may use the proof-gated protocol-v2 profile described in Current limitations.

Daily workflow

Task Command
Check hydration and tracking state crab status
Explain one file's state crab why path/to/file
List tracked files and hashes crab ls-files
Add files through the parallel Crab path crab add <patterns>
Commit and push in one step crab ship -m "message"
Push an existing commit crab push
Pull and hydrate newly fetched pointers crab pull
Pre-fetch data without checkout changes crab fetch
Materialize content crab hydrate <patterns>
Free local disk crab dehydrate --all
Compare files at two Git refs crab diff REF1 REF2
Acquire advisory file locks crab lock path/to/file
Diagnose local setup crab doctor

Crab also supports standard Git remotes alongside a Crab remote. For a GitHub/GitLab code-review workflow, use mirror mode so code and pointer blobs go to the normal Git remote while large-file content is uploaded to Crab storage first.

Migrating an existing repository

There are two migration strategies:

Adopt the current working tree

crab adopt converts selected files in the current tree into pointers and stages their original content. This is the safer default because it does not rewrite existing commits:

crab init --storage-provider s3 crab://my-bucket/my-project
crab adopt --dry-run
crab adopt --pattern '*.bin' --pattern '*.safetensors'
git diff --cached
crab ship -m "Adopt large files into Crab"

Rewrite history

crab migrate import can convert large files in history, while crab migrate export can convert pointers back to full blobs. History rewriting changes every affected commit and requires coordination, a backup, and a force push. Use --dry-run first and read the migration guide before proceeding.

Project configuration

crab.toml is the repository-committed project configuration. It tells collaborators which Crab remote and storage provider to use and can declare tracking and hydration policy:

[remote]
url = "crab://my-bucket/my-project"

[auth]
storage_provider = "s3"

[track]
patterns = ["*.safetensors", "*.bin", "datasets/**"]

[hydrate]
default = "lazy"
auto_patterns = ["README*", "*.toml", "src/**/*.rs"]

The local .crab/local.toml stores machine-specific settings such as an AWS profile selector, cache paths, and operational tuning. It should not be committed. Staging, caches, journals, and locks live elsewhere under .crab/; staging may contain unpublished data and is not a disposable cache.

Useful configuration commands:

crab config get auth.storage_provider
crab config set auth.storage_provider gcs
crab config set auth.aws_profile ml-team
crab config set checkout.lazy true
crab config set hydrate.include '*.safetensors'

For teams that want named hydration sets, add them to crab.toml:

version = 1

[prefetch.profiles.always]
paths = ["README.md", "*.toml", "src/**/*.rs"]

[prefetch.profiles.ci]
paths = ["tests/fixtures/**", "scripts/**"]

See Project Configuration for the full schema and precedence rules.

Advanced capabilities

The core Git/file workflow is the recommended starting point. The same CLI also includes:

Detailed command documentation is available in the CLI reference and in crab/docs/guides/.

Automation and structured output

Human-readable output is the default. Automation can opt into:

crab status --json
crab hydrate --jsonl
crab push --json
crab doctor --json

--json emits one result envelope. --jsonl emits newline-delimited progress events followed by a terminal result event. Successful envelopes contain schema, version, timestamp, and data; failures contain an error object with a stable CRAB-E#### code, category, retryability, and source chain.

Useful diagnostics for CI and bug reports:

crab env --json
crab doctor --json
crab errors
crab logs list

Do not include credential values or token-cache contents in bug reports.

Reliability and storage safety

Crab's storage pipeline is designed around a few important boundaries:

Garbage collection and cleanup can remove unreferenced remote data. Always verify the repository scope and retention window before running them, especially when a bucket contains more than one logical repository.

Current limitations

The following behaviors are intentional and should be considered when designing integrations:

The Git integration architecture guide contains the detailed capability matrix and evidence boundaries.

Repository layout

.
├── crab/                 Rust CLI, remote helper, engine, and product wiring
├── crates/               Shared Rust contracts and storage/data-plane crates
├── crab/docs/            Architecture notes, guides, designs, and references
├── packages/web/         Marketing site and published documentation source
├── diagram/              Architecture diagrams and rendered assets
├── .github/workflows/    CI, release, and service evidence workflows
├── Cargo.toml            Rust workspace manifest
└── LICENSE               Apache-2.0 license

The Rust workspace contains the crab binary and the shared crates for auth, cache, coordination, Git, LFS, metadata, reading, staging, storage, types, virtual filesystems, workflows, and Xet-style chunking.

Development

Prerequisites

Build and verify

Run the standard checks from the CLI crate:

cd crab

# Fast compile check
make check

# Full Rust test suite
make test

# Strict linting
make clippy

# Format the workspace
make fmt

For a local release-style binary and Git helper:

cd crab
make install
crab version
command -v git-remote-crab

Use a separate CARGO_TARGET_DIR when building multiple checkouts or when working on a disk-constrained machine. Do not commit generated build artifacts, local credentials, cache contents, staging databases, or cloud test output. Maintainers should follow RELEASING.md for versioning, tagging, and GitHub release verification.

Local end-to-end testing

The repository includes a RustFS-based local object-storage workflow that exercises initialization, pointer conversion, push, fetch, hydration, and conditional manifest/ref updates:

Local RustFS development guide

The test suite also contains in-memory and no-cloud integration coverage for the shared crates. Provider-specific credentials and live tests should be run only in an isolated test bucket or environment.

Documentation

When changing a user-visible command, configuration key, serialized format, storage layout, or error contract, update the matching guide and architecture note. The local documentation indexes are:

Troubleshooting

Start with the environment and health checks:

crab env
crab doctor
crab status

Common problems:

For detailed command-specific troubleshooting, see the guide index or the online CLI documentation.

Contributing

Contributions are welcome. A useful change generally includes:

  1. A focused implementation with clear ownership in the CLI or the shared crate that owns the relevant contract.
  2. Regression tests for changed behavior and error paths.
  3. Updated user documentation when the behavior or configuration surface changes.
  4. Formatting, compile, lint, and targeted test evidence in the pull request.

Before opening a pull request, run the narrowest rele

crab (crabbuild/crab)

Searching Database…

156 ·GitHub
What is this?Crab is a Git extension that keeps large files like models, datasets, media, and build artifacts out of ordinary Git blobs. Git stores small pointer files while Crab stores the real content as deduplicated chunks in an S3, GCS, Azure, or S3-compatible bucket you own.
Is this a Git LFS replacement or a separate storage server I have to run?It's a CLI plus a Git remote helper (git-remote-crab) and a filter driver that hook into normal Git workflows. There's no Crab server or database to deploy; each developer talks directly to your own cloud bucket.
How do I get it running on an existing repo?Install via Homebrew, the checksum-verifying installer on macOS/Linux, or the PowerShell installer on Windows, then run 'crab configure' to pick a storage provider and set up the filter driver, and 'crab ship' to stage, commit, and push in one step.
What do I need before using Crab?You need write credentials for your own Amazon S3, GCS, Azure Blob, or S3-compatible bucket; Crab discovers credentials from standard sources like AWS profiles, SSO, or Application Default Credentials. Building from source needs Rust stable (2024 edition) and Git.
Is lazy clone the same as Git's partial clone?No. Crab's lazy checkout fetches full Git history and packs but only defers Crab-managed large-file payloads, which is different from Git's native --filter=blob:none partial clone. The proof-gated protocol-v2 fetch path is still being qualified across providers.
Does it work on Windows, macOS, and Linux?Yes, Crab ships installers for macOS, Linux (Homebrew or shell installer), and Windows (PowerShell installer). FUSE/NFS mounting support depends on the host OS and extra build dependencies.
Where does my data actually go?All large-file content goes to a cloud bucket you own and control (S3, GCS, Azure, or compatible), not to any third-party Crab service.
Can I still use normal Git commands like clone, branch, and merge?Yes, Crab is designed to keep the familiar Git workflow: clone, branch, commit, merge, push, fetch, and review all work as expected.
How does Crab save disk space?It supports dehydration, replacing clean, verified full files with small pointer blobs so you can free local disk without losing the remote content, and lazy clone keeps files as pointers until explicitly hydrated.
Can I migrate an existing repo with large files already committed?Yes, via 'crab adopt' to convert the current working tree without rewriting history, or 'crab migrate import/export' to rewrite history, which requires a backup and force push.
Can I use Crab alongside GitHub/GitLab code review?Yes, mirror mode lets code and pointer blobs go to your normal Git remote for review while large-file content uploads to Crab storage separately.
What are similar projects?gat, rclone, walgithub, jj, kopia, sftpgo, walgit, dvc
Creator
crabbuild
Size
46.1 MB
Stars
156
Age
2mo
Commits · 90 Days