resolve: authenticate clones via gh CLI / token — never fall into git's interactive prompt #13
Labels
No labels
blocked
blocker:ci-red
blocker:conflict
blocker:drill-pending
blocker:unrequested
bug
claimed
documentation
enhancement
epic
merge-next
needs-triage
ready
release
scope:apply
scope:capture
scope:coolify-api
scope:fleet
scope:manifest
scope:secrets
stale
state:addressing
state:bots-reviewing
state:building
state:needs-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: heavy-duty/cast#13
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Repro
The operator was logged into
ghat the time. cast still failed.Root cause
resolveCheckout(src/resolve.ts) shells out to a bare clone and reliesentirely on the ambient git credential helper:
On a workstation with no helper configured, git falls through to its
interactive username/password prompt — which GitHub no longer accepts — and the
resulting error talks about the repository rather than about cast's missing
credentials. Being logged into
ghdoes not help:gh auth loginalone doesnot wire git's credential helper (that is
gh auth setup-git, a separate actmost people never run).
This is not routable around for prod:
resolveCheckoutrefuses--pathwhen--env prod, by design ("prod always reads the default branch"), so the cloneis the only path and its auth is mandatory.
Proposal
Resolve credentials in this order, inside cast:
ghas a per-invocation credential helper — no mutation of the user'sglobal git config:
git -c credential.helper='!gh auth git-credential' clone --depth 1 …GITHUB_TOKEN/GH_TOKENfrom the environment, if set (the CI path).And regardless of which path is taken, set
GIT_TERMINAL_PROMPT=0so castcan never hang on or fall into an interactive prompt. When all three fail, exit
with an actionable error rather than git's:
Please do not embed the token in the clone URL or in
http.extraheader—both leak it into
psoutput and, for the latter, into the clone's git config.Acceptance
ghlogged in and no git credential helper configured,cast diff <private-slug> --env prodclones successfully.never prompts.