fix(deploy): say which branches exist instead of failing inside git
The installer clones BRANCH, which defaults to main — and the repository has no main. Git's own "Remote branch not found" reads like a bad token or an unreachable server, and the branch is the one thing here that is routinely wrong. It now asks first and, when the branch is missing, prints the ones that do exist and how to pass one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>feat/portal-design
parent
4f3e11ae5e
commit
c119e8d96e
|
|
@ -166,6 +166,22 @@ else
|
|||
chown "$APP_USER" "$askpass"
|
||||
trap 'rm -f "$askpass"' EXIT
|
||||
|
||||
# Ask what is actually there before cloning. Without this, a BRANCH that
|
||||
# does not exist fails inside git with "Remote branch not found", which
|
||||
# reads like a broken token or an unreachable server — and the branch is
|
||||
# the one thing here that is routinely wrong.
|
||||
remote_heads="$(GIT_ASKPASS="$askpass" GIT_TERMINAL_PROMPT=0 \
|
||||
as_app git ls-remote --heads "${REPO_URL/https:\/\//https://oauth2@}" 2>/dev/null \
|
||||
| sed 's|.*refs/heads/||')" \
|
||||
|| die "Could not reach ${REPO_URL}. Check the server and the token."
|
||||
|
||||
if ! grep -qxF "$BRANCH" <<<"$remote_heads"; then
|
||||
die "The repository has no branch '${BRANCH}'. It has:
|
||||
$(sed 's/^/ /' <<<"$remote_heads")
|
||||
|
||||
Pass the one you want: BRANCH=<name> bash install.sh"
|
||||
fi
|
||||
|
||||
GIT_ASKPASS="$askpass" GIT_TERMINAL_PROMPT=0 \
|
||||
as_app git clone --quiet --branch "$BRANCH" "${REPO_URL/https:\/\//https://oauth2@}" "$INSTALL_DIR"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue