clone over SSH while the repository is private
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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"; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user