Skip to main content

Investigate: Fix dev-template by replacing git clone with zip download

IMPLEMENTATION RULES: Before implementing this plan, read and follow:

Status: Done​

Goal: Fix dev-template hanging on fresh machines by replacing git clone with a zip download.

Last Updated: 2026-02-19

GitHub Issue: #63


Questions to Answer​

  1. Why does the script hang?
  2. What is the minimal fix?
  3. Can we do this without changes to the templates repo?

Root Cause​

dev-template.sh line 86 uses git clone to fetch templates:

if ! git clone --quiet $TEMPLATE_REPO_URL 2>/dev/null; then

On a fresh machine, git's credential helper can prompt for HTTPS auth. With 2>/dev/null suppressing all output and no GIT_TERMINAL_PROMPT=0, the script hangs silently. The user sees the last printed message ("Detecting GitHub repository information...") and nothing else — the hang is actually in the next function (clone_template_repo).


Current State​

How dev-template fetches templates today​

TEMPLATE_REPO_URL="https://github.com/terchris/urbalurba-dev-templates"
git clone --quiet $TEMPLATE_REPO_URL 2>/dev/null

This clones the entire repo (including git history) into a temp directory, then scans templates/*/TEMPLATE_INFO for the menu.

How dev-sync fetches updates (the pattern to follow)​

curl -fsSL "https://github.com/$REPO/releases/download/latest/dev_containers.zip" -o "$ZIP_FILE"
unzip -q "$ZIP_FILE" -d "$TEMP_DIR/"

No git auth needed. Fast. Works everywhere.

GitHub archive URLs​

GitHub provides zip archives for any public repo without authentication:

https://github.com/terchris/urbalurba-dev-templates/archive/refs/heads/main.zip

This requires no changes to the templates repo — no CI/CD, no releases. The URL works for any public repo.

When unzipped, the directory is named urbalurba-dev-templates-main/ (repo name + branch).


Scope: What changes and what stays​

AspectChange?Notes
Download methodYESgit clone → curl + unzip
Template scanningMinorAdjust directory name (-main suffix)
TEMPLATE_INFO formatNOKeep current 4 fields
Menu systemNOKeep current flat dialog menu
Category groupingNOKeep hardcoded WEB_SERVER/WEB_APP/OTHER
Error handlingYESShow download errors, don't suppress
detect_github_info()YESAdd git repo check, better error messages

Error Handling Improvements (included in fix)​

LocationCurrentFixed
detect_github_info()No git repo checkCheck git rev-parse --git-dir first
detect_github_info()One error for all failuresSeparate messages for no-repo, no-remote, non-GitHub
clone_template_repo()2>/dev/null hides errorsShow curl error output
clone_template_repo()No hang protectioncurl never prompts for credentials
clone_template_repo()No download verificationCheck zip exists and is not empty

Recommendation​

Replace git clone with curl using GitHub's archive URL. This is a minimal, focused fix:

  • No changes needed in the templates repo (no CI/CD, no releases)
  • No changes to TEMPLATE_INFO format (keep current 4 fields)
  • No changes to the menu system (keep current flat menu)
  • Better error handling as a bonus

The only code changes are in clone_template_repo() and detect_github_info() in .devcontainer/manage/dev-template.sh.


Next Steps​

  • Create PLAN-dev-template-zip-fix.md with the fix