Summary

Ken Muse’s technical guide to a specific edge case in Git LFS migration: when a repository contains a .lfsconfig file that hardcodes an LFS endpoint URL, the standard mirror migration process silently continues pointing to the old LFS server. The fix is to remove the lfs.url key from .lfsconfig before or after migration.

Ken Muse 關於 Git LFS 遷移中一個特定邊界情況的技術指南:當倉庫包含硬編碼 LFS 端點 URL 的 .lfsconfig 文件時,標準鏡像遷移過程會靜默地繼續指向舊 LFS 服務器。修復方法是在遷移前後從 .lfsconfig 中刪除 lfs.url 鍵。

Key Points

  • Default LFS behavior: uses the Git remote HTTPS URL + .git/info/lfs as the LFS endpoint; no config needed
  • .lfsconfig override: lfs.url or remote.<remote>.lfsurl overrides the default endpoint; allows pointing to external LFS server (Gitea, S3-backed, etc.)
  • Migration problem: after git clone --bare && git lfs fetch --all && git push --mirror, the .lfsconfig still points to the old server → LFS fetches go to wrong place
  • Fix: git config unset -f .lfsconfig lfs.url removes the hardcoded URL so LFS falls back to the default (new repo’s endpoint)
  • lfs.pushurl vs lfs.url: separate config for upload vs. download; both must be updated
  • Priority: Git config files always override .lfsconfig; use env vars or git config for temporary overrides during migration

Insights

This is the kind of specific, hard-to-Google operational knowledge that’s valuable precisely because it’s an edge case. The .lfsconfig problem is silent — the migration appears to succeed, but subsequent git lfs fetch operations use the old endpoint. This creates confusing failures for developers who cloned from the new location but get LFS 404s because the config still points to the old server. The fix is a one-liner, but finding the problem requires understanding the LFS endpoint resolution order, which isn’t well-documented.

Connections

Raw Excerpt

If the repository contains an .lfsconfig file, interactions with Git LFS could remain pointed to the wrong endpoint. Despite the LFS data having been migrated to the new location, the configuration could continue to use the original repository storage.