Browse docs
Docs / Guides / Git and Swarmfile
View as Markdown

Git and Swarmfile

On this page

For an organization, Swarmfile is a version-control system in its own right - and for large, binary-heavy repositories a more flexible one than Git: there is nothing to clone or keep in sync (the repository streams from a mounted drive), access is per folder, and locking, review, rollback and releases are built in. Nothing here asks you to leave Git: the three paths below are where the two meet, so you can adopt Swarmfile self-serve through whichever fits and move more of your work over at your own pace.

Swarmfile isn't a full code-hosting forge (public repositories get only a light issue tracker, and code review happens through Swarmfile's own merge requests), but a repository with git access enabled serves a real git repository you can git clone swarmfile:// and git push to. Plenty of teams that use it live in git too, so there are three separate ways the two fit together. They solve different problems, and you can use any combination:

What it's forWhere your source lives
Swarmfile as your git-LFS serverKeep your repo on your git host; send the big binary files to Swarmfile.Your git host
git clone swarmfile://Get a real git repository of a Swarmfile repository, for git tooling, CI, or an offline archive, and push commits back.Swarmfile (the mounted drive)
The swarmfile CLI's git-style commandsDo version control on the mounted drive with the verbs you already know.Swarmfile (the mounted drive)

1. Swarmfile as your git-LFS server#

Point git-LFS at a Swarmfile repository, and git lfs push/pull move your large files through Swarmfile while everything else stays in your existing git host. You get storage, deduplication and quota without bloating the host, pushes up to 256 GiB per object with the transfer agent, git lfs lock that is the same lock as a lock on the drive, and an exit with no lock-in: git lfs fetch --all with stock git-LFS pulls everything back. Pushed objects can also be reflected onto the mounted drive as ordinary files (through the transfer agent - a stock git-lfs push stores the object but doesn't place it on the drive).

On a managed repository, git-LFS uploads must use the Swarmfile transfer agent and are encrypted at rest; a stock direct push is refused with lfs_agent_required. On an unencrypted repository the direct paths remain and are plaintext by definition. Objects a managed repository accepted before the agent requirement are converted by an operator-run migration. git-LFS isn't available on end-to-end-encrypted repositories.

Start with Git-LFS.

2. git clone of a Swarmfile repository#

Once an owner turns on git access for a repository, anyone who can read all of it can run:

git clone swarmfile://<org>/<repository>

and get every branch and tag as real git history, with large files as LFS pointers served by Swarmfile. git fetch brings it up to date, and git push sends new commits back as Swarmfile commits with their git ids unchanged. Pushes are fast-forward only, a push to a protected branch opens a merge request instead, an existing repository can be pushed whole into a new repository, and a pushed commit must look exactly like what a clone would produce (large files as LFS pointers, submodule gitlinks as mode 160000; executable bits are kept) - the guide has the rules.

A pushed commit is provisional until a second, independent derivation confirms it. Swarmfile's hosted hub does that on its own as soon as the push's claim lands (normally within seconds); a community server confirms a member key's push from its own tree derivation at claim time (a claim it cannot reproduce waits for another key's claim); a teammate's fetch also confirms it, and swarmfile git index confirms a whole branch's unconfirmed commits in one run. A clone can opt out with git config swarmfile.confirm false. See How a pushed commit gets confirmed.

Start with Cloning a Repository with Git.

3. The swarmfile CLI speaks git#

On the mounted drive, the swarmfile CLI uses git's vocabulary where the meaning carries over - and where it doesn't, it tells you instead of failing.

Commands that work the way you expect: commit (including --amend, message-only), log, show, diff, branch, switch, checkout, restore, revert, merge, tag, describe and more. Your ~/.gitconfig aliases work too (swarmfile co, swarmfile st). Coming from Git has the full cheat sheet.

Git habits that run the real thing:

You typeIt runs
swarmfile addOpens a changelist (if one isn't open), so your next saves are staged into it.
swarmfile stash / stash push / stash saveParks the open changelist (changelist park).
swarmfile stash list / stash showLists parked work (changelist parked).
swarmfile stash pop / stash applyResumes parked work (changelist resume).
swarmfile stash drop / stash clearDiscards parked work (changelist discard), asking first.
swarmfile reset --hard <rev>swarmfile restore <rev> - one undoable commit, not a history rewrite.
swarmfile clone <repository-id> <path>Opens a mount of that repository at that path (-b <branch> pins a branch; --checkout writes a plain directory instead).

Git habits that print guidance instead: push, pull, clone (with anything other than a repository id and path), rebase, cherry-pick, rm, mv, cp, mkdir, touch, worktree, grep, init, remote, clean, reflog, mergetool, difftool, shortlog, submodule, bisect, gc, prune, fsck, archive and notes each print a one-line reason and what to do instead - push and pull explain that saves already sync, worktree points at swarmfile mounts open, grep at swarmfile-search, mergetool at swarmfile conflicts resolve --tool.

These work even when the Desktop App isn't running. The CLI reference has the details.

Compatibility at a glance#

You want to…Today
Keep source in your git host and store big files in SwarmfileWorks - git-LFS server
git lfs lock files, including files only in gitWorks
Leave with all your LFS objects using stock git-LFSWorks - git lfs fetch --all
git clone a Swarmfile repositoryWorks, once git access is on for the repository - guide
git fetch / git pull new commits into that cloneWorks, incrementally
git clone --depth N (shallow)Works, once the repository's commits are indexed; --shallow-since/--shallow-exclude don't
git push to a Swarmfile repositoryWorks, fast-forward only, on managed and unencrypted repositories, and (through the desktop engine helper or the standalone/API-key helper with this device's user-key env) on E2E repositories - rules: deleting a branch archives it, lightweight and annotated tags become Swarmfile tags (an annotated tag keeps its exact object, message, signature and id; --force moves one and :refs/tags/<tag> deletes one, unless a release was published from it), a push to a protected branch opens a merge request, an existing repository can be pushed into a new repository in batches of up to 100 commits, a merge brings unpushed side history along on an auto-archived merged/<sha> branch, and a commit changing more than 5,000 paths goes through a chunked, resumable push session with rollback; force pushes to a branch are refused for an older clone (a helper-created clone translates them into a forward commit by default) - swarmfile git force-forward lands a force's end state as a forward commit instead
Import an existing git repository into a new Swarmfile repositoryWorks - swarmfile git import creates the repository (git access on, full history) and pushes every representable branch and tag with their upstream ids; annotated tags keep their exact object id by default (--annotated-tags convert imports them as lightweight, skip/fail to leave them out or stop); a default branch that uses Git-LFS, submodules or an octopus merge is refused, while the same problem on another branch skips and lists it; re-running the command syncs upstream changes into the repository it made (--new for a second repository)
Partial clone (--filter)Not supported through the swarmfile:// helper - large files arrive as LFS pointers; the read-only HTTPS gateway supports it for public plaintext repositories
Clone over a stock https://… git URLNot on the hosted hub - use swarmfile://, or an operator-run read-only gateway for public plaintext repositories (clone/fetch, --filter, LFS downloads; no push/upload/lock)
Clone an end-to-end-encrypted repositorySupported by the desktop engine helper and the standalone/API-key helper with SWARMFILE_USER_KEY_PRIVATE_B64/SWARMFILE_USER_KEY_ID (all-inline; no LFS).
Fetch an arbitrary commit by idNot supported - branches and tags only
Executable bit in a clone or pushWorks - executable files are mode 100755 both ways (swarmfile chmod sets it on Windows)
Empty folders in a cloneNot carried - git can't store them
Git submodulesGitlink push/clone is supported in the git view; the drive hides the submodule path. git import still skips a branch containing a submodule.
Rebase, cherry-pick, history rewritingNot supported by design - Swarmfile never rewrites commits; commit --amend changes only the message

Which one should I use?#

  • Your source code already lives in git and you're happy with that → the git-LFS server on-ramp. Nothing about your workflow changes except where big files go - and when you want the drive, review and hosted CI for the whole repository, turn on git access and the same repository serves the code too.
  • Your repo lives in a git host and you want it as a Swarmfile repository → swarmfile git import <url> brings the whole history, branches and tags over in one step (reference).
  • Your repository lives on the Swarmfile drive, and some tool needs a git repository → git clone swarmfile://.
  • You're doing version control on the drive and your fingers type git → the CLI, with Coming from Git open in a tab.
  • You run coding agents in parallel on one repository → give each agent its own mounted workspace - a mount per agent and a shared dependency cache - instead of a clone or worktree per task.
  • CI that builds from a branch → you may not need a clone at all: Hosted CI runs .swarmfile/ci.yml workflows on Swarmfile's containers against the branch directly, the self-hosted Runner (Headless CI) runs jobs on your own machine, and swarmfile materialize writes any ref to a plain directory.

Something wrong or missing? Report a docs issue.