Skip to content

Dev container: add git-lfs feature to silence post-checkout warning#31

Merged
achandmsft merged 1 commit into
mainfrom
fix/devcontainer-git-lfs
May 29, 2026
Merged

Dev container: add git-lfs feature to silence post-checkout warning#31
achandmsft merged 1 commit into
mainfrom
fix/devcontainer-git-lfs

Conversation

@achandmsft
Copy link
Copy Markdown
Collaborator

What

Add the git-lfs dev container feature so the binary is on PATH inside Codespaces / Dev Containers.

Why

In any environment where git lfs install --system has been run on the host (which is the case for the default Codespaces image), git copies a post-checkout hook into every new clone. That hook expects git-lfs on PATH. The dev container image (mcr.microsoft.com/devcontainers/python:3.13-bookworm) doesn't ship git-lfs, so every git checkout / git switch / git restore prints:

This repository is configured for Git LFS but 'git-lfs' was not found on your path.
If you no longer wish to use Git LFS, remove this hook by deleting the 'post-checkout'
file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').

Repo itself does not use LFS (no .gitattributes, no filter.lfs config, no core.hookspath) — the warning is purely cosmetic, but it fires on every git operation and looks like a real problem to new users.

Deleting .git/hooks/post-checkout works once but the hook comes back on every fresh Codespace / container rebuild. Installing the git-lfs binary inside the container is the only fix that survives rebuilds.

How

One new entry under features:

"ghcr.io/devcontainers/features/git-lfs:1": {}

Adds ~5 s to the first container build and a few MB to the image. No runtime impact.

Verification

  • N/A — docs / CI-only change (.devcontainer/devcontainer.json only)
  • Built the container; git lfs version returns a version; git checkout no longer prints the warning

Checklist

  • Mirrored across both infra-bicep and infra-terraform if applicable — N/A
  • No secrets in commits, comments, or PR body
  • README updated if user-facing behavior changed — N/A (silent quality-of-life fix)
  • One logical change per PR

Codespaces hosts run 'git lfs install --system', which seeds a post-checkout hook into every clone. The python:3.13-bookworm image used by our dev container doesn't ship git-lfs, so every 'git checkout / switch / restore' prints 'This repository is configured for Git LFS but git-lfs was not found on your path.' The repo itself doesn't use LFS, so the warning is cosmetic, but it fires on every git operation and looks like a real failure to new users. Adding the git-lfs dev container feature makes the binary available and the hook becomes a silent no-op.
@achandmsft achandmsft merged commit 0189537 into main May 29, 2026
5 checks passed
@achandmsft achandmsft deleted the fix/devcontainer-git-lfs branch May 29, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant