Skip to content

Add git installation check for repository providers#7

Merged
BillJr99 merged 1 commit into
mainfrom
claude/admiring-newton-FuK5K-git-install
May 25, 2026
Merged

Add git installation check for repository providers#7
BillJr99 merged 1 commit into
mainfrom
claude/admiring-newton-FuK5K-git-install

Conversation

@BillJr99
Copy link
Copy Markdown
Owner

Summary

Adds automatic git installation verification and fallback installation for repository providers. This ensures git is available when cloning and building repositories, with graceful handling for environments where it may not be pre-installed.

Key Changes

  • New _ensure_git_installed() function in server.py: Checks if git is on PATH; if missing, attempts to install it via apt-get. Raises a descriptive error if installation fails or git remains unavailable after installation.
  • Integration points: Called in both materialize_repository() (server.py) and clone_and_build() (frontend/app.py) before repository operations.
  • Dockerfile update: Adds git to the base image build to ensure it's available in Docker environments, reducing reliance on runtime installation.
  • Comprehensive test coverage: New TestEnsureGitInstalled class with three test cases covering success path, apt-get installation, and error handling.

Implementation Details

  • Uses shutil.which("git") to detect git availability
  • Attempts apt-get update followed by apt-get install -y --no-install-recommends git
  • Includes validation that git is actually on PATH after installation
  • Provides clear error messages distinguishing between missing git and failed installation
  • Designed to run at most once per process (though not explicitly cached in this implementation)

https://claude.ai/code/session_01R2Vi6NE4wGxwv6rZ2HEXji

Repository providers shell out to git clone/pull, which fails with
"No such file or directory: 'git'" on slim base images.  Add git to
the Dockerfile's apt install line and add a runtime fallback that
apt-get installs git on demand for older images / non-Docker envs.
@BillJr99 BillJr99 merged commit 4d1bec1 into main May 25, 2026
2 checks passed
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.

2 participants