From 5881f06cbcf3a77c80a46779ec27414d75639a67 Mon Sep 17 00:00:00 2001 From: NixReaper Date: Sat, 25 Apr 2026 09:37:40 -0500 Subject: [PATCH] fix: always clean-clone source dir, drop stale master refspec workaround The old .git/config in /opt/nixpanel/src had a fetch refspec pointing to refs/heads/master (from before the branch rename). Re-running the installer with that directory present caused 'git fetch' to fail with 'couldn't find remote ref refs/heads/master'. Fix: rm -rf the source dir before cloning whenever the source step hasn't been marked done, so we always get a clean checkout with the correct branch. --- install.sh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/install.sh b/install.sh index 3de2a68..596d118 100644 --- a/install.sh +++ b/install.sh @@ -178,16 +178,11 @@ if ! step_done "source"; then [[ -z "$LATEST_TAG" ]] && LATEST_TAG="main" info "Fetching tag: $LATEST_TAG" - if [[ -d "$SRC_DIR/.git" ]]; then - git -C "$SRC_DIR" fetch --tags --quiet - git -C "$SRC_DIR" checkout "$LATEST_TAG" --quiet - else - # Try with explicit branch first, then fallback to explicit 'main' branch - git clone --depth 1 --branch "$LATEST_TAG" \ - "https://github.com/${GITHUB_REPO}.git" "$SRC_DIR" 2>/dev/null \ - || git clone --depth 1 --branch main \ - "https://github.com/${GITHUB_REPO}.git" "$SRC_DIR" - fi + # Always do a clean clone when re-running this step — avoids stale .git configs + # (e.g. old clones that tracked 'master' before the branch was renamed to 'main') + rm -rf "$SRC_DIR" + git clone --depth 1 --branch "$LATEST_TAG" \ + "https://github.com/${GITHUB_REPO}.git" "$SRC_DIR" mark_done "source" fi success "Source ready"