You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gstack-brain-init defaults to SSH remote, fails for HTTPS-configured gh #1348
gh configured with git_protocol = https (the gh auth login default)
$ gh config get git_protocol
https
$ gh auth status | grep -i protocol
- Git operations protocol: https
Reproducer
gstack-brain-init with default settings (let gh repo create make the repo) followed by the first push fails for users whose gh auth is HTTPS-only — the script asks gh for sshUrl regardless of the user's git_protocol setting, so the remote ends up as git@github.com:user/gstack-brain-user.git and git push then prompts for SSH credentials the user does not have.
User has to manually re-run with --remote https://github.com/user/gstack-brain-user.git to recover.
Expected
gstack-brain-init honors gh config get git_protocol. If it returns https, register the HTTPS clone URL; if ssh, register the SSH URL.
Actual
bin/gstack-brain-init:91 and :98 hardcode sshUrl:
# line 89-99if! gh repo create "\$DEFAULT_NAME" --private --description "gstack session memory"2>/dev/null;then# Maybe the repo already exists; try to fetch its URL.
REMOTE_URL=\$(gh repo view "\$DEFAULT_NAME" --json sshUrl -q .sshUrl 2>/dev/null ||echo"")
...
else
REMOTE_URL=\$(gh repo view "\$DEFAULT_NAME" --json sshUrl -q .sshUrl 2>/dev/null ||echo"")
fi
Both branches request sshUrl unconditionally.
Suggested fix
Pick the URL field based on gh config get git_protocol:
Defaulting to HTTPS when git_protocol is unset matches gh auth login's own default.
The interactive prompt at bin/gstack-brain-init:105 ("Paste a private git URL (e.g. git@github.com:you/gstack-brain.git)") could similarly show the user's preferred protocol in the example, but the auto-create path is where the silent failure happens.
Taking this. Plan: honor gh config get git_protocol (and glab config get git_protocol for the gitlab branch) when deriving the push URL in gstack-artifacts-init — defaulting to HTTPS when the user's CLI is configured for HTTPS, SSH otherwise. Add a --push-protocol https|ssh|auto override flag for explicit pinning. (Script was renamed bin/gstack-brain-init → bin/gstack-artifacts-init in v1.27.0.0; bug still lives at line 184.) PR shortly.
Still present in 1.58.5.0, and it's gotten stricter than described here: the original recovery path in this issue (--remote https://...) no longer works. gstack-artifacts-init (the renamed script) now canonicalizes any input URL and unconditionally re-derives the SSH form before verifying:
# bin/gstack-artifacts-init:184 @ 1.58.5.0
PUSH_URL=$("$URL_BIN" --to ssh "$CANONICAL_HTTPS"2>/dev/null ||echo"$CANONICAL_HTTPS")# :188 — hard exit 1 when git ls-remote over SSH fails
So on an HTTPS-only machine (ghgit_protocol = https, no SSH key on the account — my case, Windows 11 + Git Credential Manager) there is no CLI escape hatch at all: even an explicit HTTPS --remote gets converted to git@github.com:... and the script exits at the ls-remote gate.
Data point supporting the protocol-honoring fix @0xDevNinja described: I patched PUSH_URL="$CANONICAL_HTTPS" locally and everything downstream works over HTTPS — init, initial push, and ongoing gstack-brain-sync (which just runs git push origin HEAD against whatever origin is configured, so it's protocol-agnostic by construction). A --push-protocol override flag would also have unblocked this without the local patch.
@16francej — recommend closing this issue only after #2225 lands following its remaining composition check. The issue is handled there because the current setup rewrites explicitly configured HTTPS remotes to SSH. Please retain the explicit-HTTPS reproducer and its attribution in #2225.
Activity
0xDevNinja commentedon May 13, 2026
Taking this. Plan: honor
gh config get git_protocol(andglab config get git_protocolfor the gitlab branch) when deriving the push URL ingstack-artifacts-init— defaulting to HTTPS when the user's CLI is configured for HTTPS, SSH otherwise. Add a--push-protocol https|ssh|autooverride flag for explicit pinning. (Script was renamedbin/gstack-brain-init→bin/gstack-artifacts-initin v1.27.0.0; bug still lives at line 184.) PR shortly.hexorcist404 commentedon Jul 3, 2026
Still present in 1.58.5.0, and it's gotten stricter than described here: the original recovery path in this issue (
--remote https://...) no longer works.gstack-artifacts-init(the renamed script) now canonicalizes any input URL and unconditionally re-derives the SSH form before verifying:So on an HTTPS-only machine (
ghgit_protocol = https, no SSH key on the account — my case, Windows 11 + Git Credential Manager) there is no CLI escape hatch at all: even an explicit HTTPS--remotegets converted togit@github.com:...and the script exits at thels-remotegate.Data point supporting the protocol-honoring fix @0xDevNinja described: I patched
PUSH_URL="$CANONICAL_HTTPS"locally and everything downstream works over HTTPS — init, initial push, and ongoinggstack-brain-sync(which just runsgit push origin HEADagainst whatever origin is configured, so it's protocol-agnostic by construction). A--push-protocoloverride flag would also have unblocked this without the local patch.fix(artifacts-init): honor configured push protocol
time-attack commentedon Jul 15, 2026
@16francej — recommend closing this issue only after #2225 lands following its remaining composition check. The issue is handled there because the current setup rewrites explicitly configured HTTPS remotes to SSH. Please retain the explicit-HTTPS reproducer and its attribution in #2225.
fix(artifacts-init): honor gh/glab git_protocol when picking push URL
fix(artifacts-init): preserve user-supplied remote URL scheme under -…
v1.64.0.0 fix wave: full tracker audit — 90 fixes, 52 issues closed, …