fix(brain-init): drop --source flag before git init

gstack-brain-init used `gh repo create --source $GSTACK_HOME` before
running `git init` on that directory. gh requires --source to point at
an existing git repo, so the call fails with "not a git repository"
on first run. The fallback path (gh repo view) could only recover if
the repo was somehow pre-created — which it wasn't.

Fix: omit --source from `gh repo create`. The script's later steps
(git init, remote add, push) wire up the remote explicitly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-04-24 02:02:31 -07:00
parent 8bccf2a7aa
commit 04185d8f92
+4 -1
View File
@@ -86,7 +86,10 @@ if [ -z "$REMOTE_URL" ]; then
read -r REPLY || REPLY=""
if [ -z "$REPLY" ]; then
echo "Creating GitHub repo: $DEFAULT_NAME ..."
if ! gh repo create "$DEFAULT_NAME" --private --description "gstack session memory" --source "$GSTACK_HOME" 2>/dev/null; then
# Note: --source omitted intentionally. gh requires --source to point at
# an existing git repo, but we don't init $GSTACK_HOME until after the
# remote is chosen. Create bare, then fetch URL.
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 "")
if [ -z "$REMOTE_URL" ]; then