Git LFS
Store and manage large files with Git LFS on Coregit.
Overview
Coregit fully supports the Git LFS protocol. Large files (images, models, datasets, binaries) are stored in dedicated object storage and replaced with lightweight pointer files in your git history.
The standard git lfs client works out of the box — no special configuration or .lfsconfig needed.
How It Works
git lfs push git lfs pull
│ │
▼ ▼
┌─────────────────────┐ ┌─────────────────────┐
│ Coregit Batch API │ │ Coregit Batch API │
│ (returns signed URL)│ │ (returns signed URL)│
└────────┬────────────┘ └────────┬────────────┘
│ presigned PUT URL │ presigned GET URL
▼ ▼
┌─────────────────────┐ ┌─────────────────────┐
│ Cloudflare R2 │ │ Cloudflare R2 │
│ (direct upload) │ │ (direct download) │
└─────────────────────┘ └─────────────────────┘Your files upload/download directly to storage — the Coregit API server only handles authentication and URL signing, never the file data itself. This means no size bottleneck on the server.
Quick Start
1. Install Git LFS
# macOS
brew install git-lfs
# Ubuntu/Debian
sudo apt install git-lfs
# Then initialize (once per machine)
git lfs install2. Clone Your Repo
git clone https://org-slug:YOUR_API_KEY@api.coregit.dev/org-slug/my-repo.git
cd my-repo3. Track File Patterns
# Track all .psd files
git lfs track "*.psd"
# Track all files in a directory
git lfs track "models/**"
# Track specific large file types
git lfs track "*.bin" "*.tar.gz" "*.zip" "*.mp4"
# Always commit .gitattributes
git add .gitattributes4. Add, Commit, Push
# Add a large file
cp ~/my-model.bin .
git add my-model.bin
git commit -m "add trained model"
git push origin mainGit LFS automatically:
- Replaces
my-model.binwith a pointer file in the commit - Calls the Coregit Batch API to get an upload URL
- Uploads the file directly to R2
- Calls the verify endpoint to confirm
- Pushes the pointer file via normal git push
5. Pull / Clone with LFS
# Clone includes LFS files automatically
git clone https://org:KEY@api.coregit.dev/org/repo.git
# Or pull LFS files separately
git lfs pullNamespaced Repositories
LFS works the same with namespaced repos:
git clone https://org:KEY@api.coregit.dev/org/namespace/repo.gitThe LFS server URL is automatically derived as:
https://api.coregit.dev/org/namespace/repo.git/info/lfsFile Locking
Binary files (images, models, compiled assets) can't be merged. Use LFS file locking to prevent conflicts:
# Enable lock verification
git config lfs.https://org:KEY@api.coregit.dev/org/repo.git/info/lfs.locksverify true
# Lock a file before editing
git lfs lock assets/logo.psd
# See who has what locked
git lfs locks
# Unlock when done
git lfs unlock assets/logo.psd
# Force unlock someone else's lock (requires master API key)
git lfs unlock assets/logo.psd --forceWhen lock verification is enabled, git push will fail if you modified a file locked by someone else.
Scoped Tokens
LFS respects the same scoped token permissions as git push/pull:
# Read-only token — can pull LFS files, cannot push
git clone https://org:cgt_READ_TOKEN@api.coregit.dev/org/repo.git
# Read-write token — full LFS access
git clone https://org:cgt_WRITE_TOKEN@api.coregit.dev/org/repo.gitPublic Repositories
Public repos allow LFS download without authentication:
# No credentials needed for public repos
git clone https://api.coregit.dev/org/public-repo.git
# LFS files download automaticallyUpload always requires authentication.
Recommended .gitattributes
# Images
*.png filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.psd filter=lfs diff=lfs merge=lfs -text
*.svg filter=lfs diff=lfs merge=lfs -text
# Models & Data
*.bin filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
# Archives
*.zip filter=lfs diff=lfs merge=lfs -text
*.tar.gz filter=lfs diff=lfs merge=lfs -text
# Video/Audio
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.mp3 filter=lfs diff=lfs merge=lfs -textLimits
| Tier | Max File Size | Objects per Batch |
|---|---|---|
| Free | 100 MB | 20 |
| Usage | 2 GB | 100 |
| Enterprise | Custom | Custom |
LFS storage and transfer count toward your organization's existing quotas — no separate LFS billing. See Usage for current quota details.
Migrating from GitHub LFS
# Clone from GitHub with LFS
git clone https://github.com/org/repo.git
cd repo
git lfs fetch --all
# Add Coregit as remote
git remote add coregit https://org:KEY@api.coregit.dev/org/repo.git
# Push everything including LFS objects
git push coregit main
git lfs push --all coregit