From 1f0368f1dd24eb9e8ee1c840d7b7b280ece31da7 Mon Sep 17 00:00:00 2001 From: Jakub Dorfman Date: Wed, 29 Apr 2026 18:38:29 +0200 Subject: [PATCH] fix: check for git installation before cloning repository in HTTP handler Co-authored-by: Copilot --- panel/panel-api.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/panel/panel-api.py b/panel/panel-api.py index 8bb5c3c..e320f88 100644 --- a/panel/panel-api.py +++ b/panel/panel-api.py @@ -602,6 +602,12 @@ class Handler(BaseHTTPRequestHandler): return # Clone the repository + git_bin = shutil.which("git") + if not git_bin: + run_panelctl(["remove", name]) + self._json(400, {"ok": False, "error": "git is not installed or not in PATH"}) + return + target_dir = os.path.join(app["APP_STACK_DIR"], "repo") if os.path.exists(target_dir): shutil.rmtree(target_dir) @@ -614,7 +620,7 @@ class Handler(BaseHTTPRequestHandler): auth_url += ".git" clone_result = subprocess.run( - ["git", "clone", "--branch", branch, auth_url, target_dir], + [git_bin, "clone", "--branch", branch, auth_url, target_dir], capture_output=True, text=True )