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
这是什么?Crab 是一个 Git 扩展,把模型、数据集、媒体文件和构建产物等大文件排除在普通 Git blob 之外。Git 只存储小的指针文件,而 Crab 把真实内容作为去重后的分块存储在你自己拥有的 S3、GCS、Azure 或 S3 兼容存储桶中。
它是 Git LFS 的替代品,还是我必须自己运行的独立存储服务器?它是一个 CLI,外加一个 Git remote 助手(git-remote-crab)和一个 filter 驱动,挂接到正常的 Git 工作流中。无需部署任何 Crab 服务器或数据库;每个开发者直接与你自己的云端存储桶通信。
怎么在现有仓库上用起来?通过 Homebrew、macOS/Linux 上带校验和验证的安装器或 Windows 上的 PowerShell 安装器安装,然后运行 “crab configure” 选择存储服务商并配置 filter 驱动,再运行 “crab ship” 一步完成暂存、提交和推送。
使用 Crab 之前需要准备什么?你需要自己拥有的 Amazon S3、GCS、Azure Blob 或 S3 兼容存储桶的写入凭据;Crab 会从 AWS 配置、SSO 或 Application Default Credentials 等标准来源发现凭据。从源码构建需要 Rust stable(2024 edition)和 Git。
lazy clone 和 Git 的 partial clone 是一回事吗?不是。Crab 的 lazy checkout 会获取完整的 Git 历史和 pack,只是推迟获取 Crab 管理的大文件负载,这与 Git 原生的 --filter=blob:none partial clone 不同。带证明门控的 protocol-v2 抓取路径仍在各服务商处进行资格验证。
它能在 Windows、macOS 和 Linux 上用吗?可以,Crab 为 macOS、Linux(Homebrew 或 shell 安装器)和 Windows(PowerShell 安装器)提供安装器。FUSE/NFS 挂载支持取决于宿主操作系统和额外的构建依赖。
我的数据实际存放在哪里?所有大文件内容都进入你自己拥有和控制的云端存储桶(S3、GCS、Azure 或兼容服务),不会进入任何第三方 Crab 服务。
我还能正常使用 clone、branch、merge 等 Git 命令吗?可以,Crab 的设计目标就是保留熟悉的 Git 工作流:clone、branch、commit、merge、push、fetch 和代码审查都按预期工作。
Crab 如何节省磁盘空间?它支持脱水(dehydration),把干净、经过校验的完整文件替换为小的指针 blob,让你在不丢失远端内容的情况下释放本地磁盘;lazy clone 则把文件保持为指针,直到你显式将其恢复为完整内容。
已有大文件提交的现有仓库可以迁移吗?可以,通过 “crab adopt” 在不改写历史的情况下转换当前工作树,或通过 “crab migrate import/export” 改写历史,后者需要先备份并强制推送。
我能把 Crab 与 GitHub/GitLab 代码审查一起用吗?可以,镜像模式让代码和指针 blob 进入你正常的 Git 远端用于审查,而大文件内容单独上传到 Crab 存储。
What are similar projects?gat, rclone, walgithub, jj, kopia, sftpgo, walgit, dvc
Creator
crabbuild
Size
46.6 MB
Stars
156
Age
2mo
Commits · 90 Days