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.
This commit is contained in:
+3
-8
@@ -178,16 +178,11 @@ if ! step_done "source"; then
|
|||||||
[[ -z "$LATEST_TAG" ]] && LATEST_TAG="main"
|
[[ -z "$LATEST_TAG" ]] && LATEST_TAG="main"
|
||||||
info "Fetching tag: $LATEST_TAG"
|
info "Fetching tag: $LATEST_TAG"
|
||||||
|
|
||||||
if [[ -d "$SRC_DIR/.git" ]]; then
|
# Always do a clean clone when re-running this step — avoids stale .git configs
|
||||||
git -C "$SRC_DIR" fetch --tags --quiet
|
# (e.g. old clones that tracked 'master' before the branch was renamed to 'main')
|
||||||
git -C "$SRC_DIR" checkout "$LATEST_TAG" --quiet
|
rm -rf "$SRC_DIR"
|
||||||
else
|
|
||||||
# Try with explicit branch first, then fallback to explicit 'main' branch
|
|
||||||
git clone --depth 1 --branch "$LATEST_TAG" \
|
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"
|
"https://github.com/${GITHUB_REPO}.git" "$SRC_DIR"
|
||||||
fi
|
|
||||||
mark_done "source"
|
mark_done "source"
|
||||||
fi
|
fi
|
||||||
success "Source ready"
|
success "Source ready"
|
||||||
|
|||||||
Reference in New Issue
Block a user