From 04185d8f92a72c0d622856c7c7a7df7f56d4a375 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Fri, 24 Apr 2026 02:02:31 -0700 Subject: [PATCH] fix(brain-init): drop --source flag before git init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- bin/gstack-brain-init | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/gstack-brain-init b/bin/gstack-brain-init index 6399c12c..3ed48559 100755 --- a/bin/gstack-brain-init +++ b/bin/gstack-brain-init @@ -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