Updated November 10, 2026
Git LFS migration: the gotchas that bite between the pointer file and the blob
Planning a Git LFS move between hosts is not the same as moving a Git repo. A practical guide to the pointer/blob split, quota walls, mirror commands that drop blobs, and cutover patterns that don't leave the new host with unresolvable pointers.
Update, November 2026. Two corrections. GitHub no longer sells Git LFS data packs: LFS is metered, with 10 GiB of storage and bandwidth included on Free and Pro and 250 GiB on Team and Enterprise Cloud, so the bandwidth advice is rewritten. And the closing section now says which paths transfer LFS objects in the platform (GitLab and Azure DevOps to GitHub) and which do not (Bitbucket to GitHub, where it is a separate manual step).
Git LFS migration reads on paper like a subset of the Git migration problem. In practice it is a distinct workstream that has to be planned separately, because LFS is two things, transported over two protocols, billed against two different meters, and one of them (the LFS binary storage) is not what git clone, git push, or git bundle actually move. Teams that treat LFS as "we're moving Git, LFS comes along" discover the split late, usually when the first developer on the new host runs git lfs pull and gets an authentication error against an LFS server that no longer exists.
This post is the LFS-specific guide: what actually has to move (pointers and blobs), what breaks first (quota walls, missing objects, mirror commands that silently skip LFS), and how to cut over without leaving the destination host with a large tree of unresolvable pointer files. The large-repo and history post covers the case where LFS is introduced during the migration to escape a 100 MiB limit; this post is about estates that already use LFS on the source and need to move it as-is.
TL;DR
- LFS pointers and LFS blobs move separately. Pointers travel with the Git objects; blobs travel on a distinct HTTPS batch protocol against a distinct LFS server URL. Any migration procedure that does not explicitly account for both leaves half of LFS behind.
git clone --mirrorandgit bundledo not fetch LFS blobs. Rungit lfs fetch --allagainst the source before you push anywhere, or the destination will hold pointer files with nothing to resolve them against.- LFS storage is billed against the sum of every unique object ever pushed, not the current checkout. A 20 GB working tree can be 200+ GB of LFS storage after a few years, and the destination bill reflects the tail, not the tip.
- Run
git lfs fsckon the source before migrating. Missing blobs are a realistic risk on older LFS estates, and decisions about them must precede the transfer, not follow it. .gitattributesLFS tracking rules are per-branch, not global. Rules drift between branches over time and a naive migration ships the drift into the destination unmodified.- Storage quotas and bandwidth caps on the destination bite mid-migration, not at planning time. Confirm the target account's limits before you start, and staging by wave keeps the failure blast radius bounded.
The split that causes most of the pain
A Git repository with LFS stores two categories of object in two different places. Git objects (commits, trees, blobs for non-LFS files, and the LFS pointer files) live in .git/objects and travel with any Git operation. LFS blobs (the actual bytes of the tracked files: PSDs, MP4s, model weights, game assets, whatever) live in .git/lfs/objects locally and on a distinct LFS server remotely, addressed via the lfs.url config or the LFS server URL advertised by the Git host.
The consequence: any operation that touches only Git objects moves half of the story. git clone fetches Git objects; git lfs pull fetches LFS blobs corresponding to the current checkout. git clone --mirror fetches every Git ref and every reachable Git object, but not the LFS blobs referenced by those objects; you need git lfs fetch --all for that, and even then only against a source you can still authenticate against.
The .gitattributes file is what links the two: entries like *.psd filter=lfs diff=lfs merge=lfs -text tell Git to smudge and clean matching files through the LFS filter. If .gitattributes disagrees with reality (the file says a pattern is LFS-tracked but the pointer file in Git is actually a binary, or vice versa), Git operations fail in confusing ways after the move. Every migration inventory step should read .gitattributes on every branch, not just main.
Storage and bandwidth: what the numbers actually look like
LFS estates are billed against two meters on the major hosts: storage (bytes stored) and bandwidth (bytes downloaded per period). The two numbers behave differently under migration and both can wall the process off if unplanned.
| LFS estate size | Typical unique objects | Pure transfer time on 1 Gbps | Destination write time (GH LFS) |
|---|---|---|---|
| 20 GB (small) | 5 to 20 thousand | 3 to 5 min | 5 to 10 min |
| 200 GB (mid) | 50 to 200 thousand | 30 to 45 min | 45 to 90 min |
| 2 TB (large) | 500 thousand to 2 million | 5 to 8 hours | 10 to 20 hours |
| 20 TB (huge) | 5+ million | 2 to 4 days | 4 to 10 days |
Ranges are planning estimates derived from link speed, not measurements; validate them on a pilot transfer before you commit to a window. Actual times depend on transfer concurrency (Git LFS runs 8 concurrent transfers by default, set by lfs.concurrenttransfers, and servers rate-limit clients that push far past that), source-side bandwidth caps, and any transport-level compression the storage backend applies.
Two effects worth calling out before you plan a specific window:
- Source-side bandwidth is often the bottleneck. Hosted LFS services rate-limit clients, and a self-hosted LFS server behind a corporate proxy is limited by that proxy, so the download from the source can be much slower than the upload to the destination. Measure both directions on a pilot repository and plan the migration window around the slower half.
- Destination bandwidth costs on GitHub LFS are metered separately. GitHub includes 10 GiB of LFS bandwidth and 10 GiB of storage a month on Free and Pro, and 250 GiB of each on Team and Enterprise Cloud, then bills usage beyond that on a meter; the old pre-paid data packs have been removed. Once the destination is live, every developer clone pulls LFS blobs against that meter. Set the LFS budget for the destination account up front; discovering that a spending limit blocks downloads while a fleet of developers is
git lfs pull-ing on day one is a preventable Sev-2.
git clone --mirror does not do what you think for LFS
The reflexive incantation for a full-fidelity repo copy is git clone --mirror <src>, followed by git push --mirror <dst>. This is correct for Git objects and refs, and completely silent about LFS. The mirror clone will happily pull down 4 GB of pointer files and appear to succeed; the destination will happily receive them and appear to succeed; and every LFS-tracked file on the destination will be an unresolved pointer.
The correct sequence:
git clone --mirror https://src.example/org/repo.git repo.git
cd repo.git
git lfs fetch --all # pull every LFS blob for every ref
git remote set-url origin https://dst.example/org/repo.git
git push --mirror
git lfs push --all origin # upload every LFS blob to destination
Two things this script does not handle that a real migration needs to:
- Authentication against both LFS servers.
git lfs fetch --allneeds credentials for the source LFS server, which is often not the same credential as the source Git server (Bitbucket especially separates them).git lfs push --allneeds credentials for the destination. Configure both in a credential helper before you start; interactive prompts break automation. - Partial-failure recovery.
git lfs push --allon a large estate will hit transient failures. Wrap it in a retry loop with exponential backoff, and after it completes, rungit lfs fsckagainst the destination to confirm every referenced blob is present. Do not assume apush --allthat exits 0 actually pushed everything: it exits 0 on connection failures too if retries eventually succeed, but a corrupted upload can still leave a bad blob.
Track drift: .gitattributes per branch
git lfs track "*.psd" writes an entry to .gitattributes on the current branch. It does not migrate existing files matching that pattern, and it does not apply retroactively to history. Both of those facts trip up migrations in different ways.
The first: on the source, .gitattributes typically drifts between branches. main tracks *.psd and *.mp4 as LFS; a long-running feature branch from 18 months ago tracks only *.psd. When the migration pushes both branches, the destination has one branch where MP4s are LFS pointers and one where they're 400 MB binary blobs in the Git object database. If the destination host has a hard file-size limit (GitHub blocks pushes containing files over 100 MiB), that second branch fails to push even though the first succeeded.
The second: teams sometimes add git lfs track to a repo after checking in a 300 MB PSD as a plain binary. Every subsequent commit stores the PSD as a proper LFS pointer, but the historical blob is still in Git and still ships with any clone. The migration is a natural moment to either accept the history as-is (usually fine for small estates), or run git lfs migrate import with --above=100M --everything to sweep those historical blobs into LFS, at the cost of rewriting every SHA in the affected branches. The rewrite has downstream effects (open PRs on the source, CI caches, deployment tags) that should be planned separately.
Missing blobs: assume some, plan for it
Assume an older LFS estate has some missing blobs until git lfs fsck says otherwise. The failure modes are numerous and largely unlogged:
- Bandwidth cap tripped. On free-tier LFS or capped enterprise plans, an over-quota month sometimes silently dropped uploads. The pointer file was pushed to Git; the blob upload failed and was never retried.
- Storage quota exceeded. Same shape, different meter.
- Force-push orphaned objects. A
git push --forcerewrote a branch and the old commit chain became unreachable. Git's garbage collection eventually prunes the pointer files; the LFS server's garbage collection may or may not prune the blobs, depending on how it enforces reachability. - Repository archived and later restored. Some hosts cold-storage LFS blobs when a repo is archived and take hours to rehydrate on first access. If a migration touches an archived repo without waking it first, blobs return 404.
- Deleted content deliberately purged. BFG or
git lfs migrate exportremoved the pointer from history without cleaning up the LFS blob, or vice versa.
Run git lfs fsck --pointers and git lfs fsck --objects on the source before any migration transfer, and record the missing-object list as a first-class deliverable. Two decisions have to be made against that list, and made before the cutover, not after:
- Blocking versus non-blocking. Is a missing blob a hard stop, or acceptable if it is documented? For most estates, the answer is "acceptable if documented and communicated to the file owner." For regulated estates (design files under FDA change control, model artifacts under an audit trail), missing blobs are hard stops that must be sourced from cold storage or reconstructed before the move.
- Placeholder policy. Some teams push a zero-byte or "MISSING" placeholder blob at the missing OID, so that
git lfs pullon the destination succeeds with a warning rather than failing hard. This is a legitimate choice and it needs to be documented in the migration record, because otherwise the destination looks like a completed migration when it is a compromised one.
Verify on the destination, not by looking at the push output
End every LFS migration with a verification pass on the destination; push output alone does not prove that every blob arrived. The minimum verification set:
git lfs fsckon a fresh clone of the destination. Not on the migration workstation (which still has the source blobs cached locally), but on a machine that has never seen the source. This is the only test that catches "the blob is cached locally sogit lfs pullsucceeds, but was never actually uploaded."- A count comparison.
git lfs ls-files --all --long | wc -lon source and destination should produce the same number. Any delta is either a legitimate missing-blob case (see above) or a failed upload that needs to be redriven. - A size comparison. Sum of unique object sizes should match within a percent or two. Small drift is explained by LFS server-side deduplication; large drift means blobs are missing.
- A sample-pull test from a real developer workstation. Someone in the target audience for the destination pulls a real branch, works with the files, and confirms no pointer files are unresolved. Automated verification finds most problems; a developer pulling on a residential connection finds the ones tied to bandwidth caps and geo-routing.
Cutover: freeze the source's LFS server, don't just the Git remote
The Git-side cutover pattern most teams already know: freeze pushes on the source, mirror the final state to the destination, redirect developer remotes, retire the source. LFS adds a step that's easy to skip: freeze uploads to the source LFS server at the same time you freeze the source Git remote.
If Git is frozen but the LFS server still accepts writes, a developer with a stale local checkout can push a Git commit that fails (Git is frozen), get a friendly error, and never realise that their git push already uploaded 4 GB of LFS blobs to a server nobody will read from again. Those blobs are effectively lost work. The reverse is also true: if the LFS server is frozen but Git is not, pushes succeed and produce pointer files with no backing blob, breaking every subsequent clone.
The right sequence:
- Announce the LFS freeze one working day before the Git freeze, so developers can push large in-flight work.
- Freeze the source LFS server (read-only mode, or a reverse-proxy 503 on write endpoints).
- Freeze the source Git remote.
- Run the final delta transfer:
git lfs fetch --allagainst source,git lfs push --allagainst destination. - Verify (see above).
- Redirect developer remotes and retire the source.
The freeze order matters. LFS first, Git second: pointers without blobs are worse than blobs without pointers, because the pointer failure is silent until pull time.
How Shyftport handles this
We treat LFS as its own migration workstream inside a larger platform move, with its own inventory, quota confirmation, transfer window, and verification pass. In practice that means we run git lfs fsck against every source repo during discovery, record the missing-object baseline, and either right-size the destination LFS plan up front or scope a purge pass with the customer if the source has years of stale binaries paid for by inertia. The shape of the gotchas is the same whatever the source host; their size and cost are not. How much of that the platform does for you depends on the path: from GitLab and from Azure DevOps, LFS objects are transferred with the repository; from Bitbucket the platform mirrors the git history but does not move LFS objects today, so the fetch, push, and verification steps above run as a separate, engineer-led step of the program. If you're planning an LFS-heavy migration and want the numbers pressure-tested against your actual estate, talk to a Shyftport engineer and we'll size the LFS workstream against your .gitattributes, blob count, and destination quotas before you commit to a window.
Sources
- About Git Large File Storage - GitHub Docs(accessed 2026-08-10)
- About storage and bandwidth usage - GitHub Docs(accessed 2026-08-10)
- About billing for Git Large File Storage - GitHub Docs(accessed 2026-08-10)
- git-lfs-fetch man page - git-lfs repository(accessed 2026-08-10)
- git-lfs-push man page - git-lfs repository(accessed 2026-08-10)
- git-lfs-fsck man page - git-lfs repository(accessed 2026-08-10)
- git-lfs-config man page - git-lfs repository(accessed 2026-11-10)
- git-lfs-migrate man page - git-lfs repository(accessed 2026-08-10)
- Storage usage quotas - GitLab Docs(accessed 2026-08-10)
FAQ
- Does 'git clone --mirror' bring the LFS blobs across?
- No. A mirror clone copies refs and Git objects, but LFS blobs live outside the Git object database, on a separate LFS server. The mirror will contain every pointer file at every historical revision, and none of the underlying binaries. You have to run 'git lfs fetch --all' against the source before pushing to the destination, or LFS pull on the new host will fail for anything not already local.
- How long does an LFS transfer take between hosts?
- It is bandwidth-bound, not compute-bound. As a planning estimate, for a 200 GB LFS estate on a 1 Gbps symmetric link expect roughly 30 to 45 minutes of pure transfer per direction (source download plus destination upload), plus overhead for authentication, retries, and any rate limiting the destination applies. Git LFS runs 8 concurrent transfers by default (lfs.concurrenttransfers), and servers rate-limit clients, so adding much more parallelism does not reliably help. Validate the estimate on a pilot repository.
- Do LFS storage quotas on the destination apply to historical revisions?
- Yes. LFS storage is measured against the sum of unique object sizes ever pushed, not against the size of the current checkout. A 20 GB working tree with three years of monthly design-file iterations can hold 300 GB of LFS storage, and the destination bills against that number. Purge old LFS objects with 'git lfs migrate export' plus history rewriting before the move if you want the destination bill to reflect the tip, not the tail.
- What if some LFS blobs on the source are missing?
- Assume some are, and run 'git lfs fsck' on the source before you migrate anything. Missing blobs are a realistic risk on any older LFS estate: bandwidth caps hit, retention policies fired, someone force-pushed and orphaned objects, a repository was archived and then unarchived. Every missing blob remains a broken pointer on the destination too. Decide up front whether missing blobs block the migration or become tracked exceptions, and record the decision before you start moving anything.
Related reading
Bitbucket Cloud vs Bitbucket Data Center to GitHub: two different migrations
GitHub Enterprise Importer migrates Bitbucket Server and Data Center 5.14+ with pull requests. For Bitbucket Cloud, GitHub documents only a source and history move. What exists in each edition, and how that changes your plan.
GitLab to GitHub with GitHub Enterprise Importer: what it migrates and what it leaves
GitHub Enterprise Importer has migrated GitLab repositories to GitHub Enterprise Cloud since August 2026. It carries Git history, issues and merge requests as pull requests, but not CI/CD, LFS objects, permissions, variables, webhooks or registries.
Migrating from GitLab to GitHub: the tooling landscape before and after the official importer
GitHub Enterprise Importer has officially migrated GitLab sources into GitHub Enterprise Cloud since 3 August 2026. What the official path covers, what it still leaves to you, and how the other tooling options compare for an enterprise-scale move.