From bedc420d4da6b93e387c4145f9da1d17b791a085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Thu, 13 Aug 2026 02:56:55 +0000 Subject: [PATCH] clone over SSH while the repository is private MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An HTTPS clone of a private repo prompts for a username, and under sudo with no interactive terminal that hangs or dies with "could not read Username" — which is what gitea.pastilhas.dev does right now. ssh://git@gitea.pastilhas.dev:2222/officerdev/platform.git instead, temporarily. Back to HTTPS when it is public; nothing else in the script cares which. Tested the path the script actually takes, not just the URL: the clone runs as the OWNER rather than root, and sudo drops SSH_AUTH_SOCK, so there is no agent to answer a passphrase. `sudo -u pastilhas env -u SSH_AUTH_SOCK git ls-remote` returns HEAD, so the key works unaided on this machine. A passphrase-protected key that relies on an agent would not. Still overridable with OFFICER_REPO. Co-Authored-By: Claude Opus 5 (1M context) --- scripts/setup/officer-setup/lib/repo.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/setup/officer-setup/lib/repo.sh b/scripts/setup/officer-setup/lib/repo.sh index 171e3846..5379d19b 100644 --- a/scripts/setup/officer-setup/lib/repo.sh +++ b/scripts/setup/officer-setup/lib/repo.sh @@ -14,7 +14,17 @@ [[ -n "${OFFICER_SETUP_REPO_LOADED:-}" ]] && return 0 OFFICER_SETUP_REPO_LOADED=1 -OFFICER_REPO="${OFFICER_REPO:-https://gitea.pastilhas.dev/officerdev/platform.git}" +# SSH rather than HTTPS, temporarily: the repository is private, and an HTTPS +# clone of a private repo prompts for a username — which under sudo, with no +# interactive terminal, hangs or dies with "could not read Username". +# +# The clone runs as the OWNER, not as root (see the note above), so it uses their +# ~/.ssh key. A passphrase-protected key normally answered by ssh-agent will not +# work here: sudo drops SSH_AUTH_SOCK, so there is no agent to ask. An unencrypted +# key, or one already accepted by the host, is what this expects. +# +# Back to HTTPS when the repository is public — nothing else here cares which. +OFFICER_REPO="${OFFICER_REPO:-ssh://git@gitea.pastilhas.dev:2222/officerdev/platform.git}" platform_dir() { echo "${OFFICER_ROOT}/platform"; }