mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-02 03:35:09 +02:00
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:
@@ -86,7 +86,10 @@ if [ -z "$REMOTE_URL" ]; then
|
|||||||
read -r REPLY || REPLY=""
|
read -r REPLY || REPLY=""
|
||||||
if [ -z "$REPLY" ]; then
|
if [ -z "$REPLY" ]; then
|
||||||
echo "Creating GitHub repo: $DEFAULT_NAME ..."
|
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.
|
# 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 "")
|
REMOTE_URL=$(gh repo view "$DEFAULT_NAME" --json sshUrl -q .sshUrl 2>/dev/null || echo "")
|
||||||
if [ -z "$REMOTE_URL" ]; then
|
if [ -z "$REMOTE_URL" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user