code-with-codespaces icon indicating copy to clipboard operation
code-with-codespaces copied to clipboard

[Bug] Codespaces environment missing git-lfs causing push failures in LFS-enabled repository

Open naoki1213mj opened this issue 6 months ago • 0 comments

Issue Summary

When using this repository in GitHub Codespaces, users encounter git push failures due to Git LFS not being pre-installed in the Codespaces environment at exercise2.

Problem Description

After completing the learning activities and attempting to push changes, users get the following error:

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 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').

Steps to Reproduce

  1. Fork this repository
  2. Open in GitHub Codespaces
  3. Complete the learning activities and make commits
  4. Run git push
  5. Error occurs

Current Workaround

Users need to manually install Git LFS:

sudo apt update && sudo apt install -y git-lfs
git lfs install --force
git push

Suggested Solutions

Option 1: Add to devcontainer configuration

Add Git LFS installation to .devcontainer/devcontainer.json:

{
  "postCreateCommand": "sudo apt update && sudo apt install -y git-lfs && git lfs install"
}

Option 2: Update documentation

Add a troubleshooting section to the README explaining this issue and the workaround.

Option 3: Remove Git LFS if not needed

If Git LFS isn't essential for this learning repository, consider removing the LFS configuration to simplify the user experience.

Impact

This affects learners trying to complete the "Code with Codespaces" skill, potentially causing frustration when they can't push their completed work.

Environment

  • GitHub Codespaces (Debian-based environment)
  • Git LFS hooks are present but git-lfs command is not installed by default

naoki1213mj avatar Jul 26 '25 01:07 naoki1213mj