Environment
- gstack
1.26.4.0
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-99
if ! 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:
PROTOCOL=\$(gh config get git_protocol 2>/dev/null || echo "https")
if [ "\$PROTOCOL" = "ssh" ]; then
URL_FIELD=sshUrl
else
URL_FIELD=url # HTTPS clone URL
fi
REMOTE_URL=\$(gh repo view "\$DEFAULT_NAME" --json "\$URL_FIELD" -q ".\$URL_FIELD" 2>/dev/null || echo "")
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.
Environment
1.26.4.0ghconfigured withgit_protocol = https(thegh auth logindefault)Reproducer
gstack-brain-initwith default settings (letgh repo createmake the repo) followed by the first push fails for users whoseghauth is HTTPS-only — the script asksghforsshUrlregardless of the user'sgit_protocolsetting, so the remote ends up asgit@github.com:user/gstack-brain-user.gitandgit pushthen prompts for SSH credentials the user does not have.User has to manually re-run with
--remote https://github.com/user/gstack-brain-user.gitto recover.Expected
gstack-brain-inithonorsgh config get git_protocol. If it returnshttps, register the HTTPS clone URL; ifssh, register the SSH URL.Actual
bin/gstack-brain-init:91and:98hardcodesshUrl:Both branches request
sshUrlunconditionally.Suggested fix
Pick the URL field based on
gh config get git_protocol:Defaulting to HTTPS when
git_protocolis unset matchesgh 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.