Skip to content

"Push your branch" suggestion does not resolve sync failure on git-init projects #350

@hidetaka-cci

Description

@hidetaka-cci

After following the CLI's suggestion (Push your branch to the remote before syncing.), chunk sidecar sync / chunk sidecar setup continues to fail with Could not resolve remote base. on projects created via git init. Setting the upstream with git push -u is not sufficient — origin/HEAD must also be set explicitly.

Steps to reproduce

mkdir my-project && cd my-project
git init
git add . && git commit -m "init"
git remote add origin git@github.com:<org>/<repo>.git
git push origin main          # initial push
chunk sidecar setup           # fails: "Could not resolve remote base."

git push -u origin main       # set upstream as suggested
chunk sidecar setup           # still fails with the same error

Expected behavior

Either:

  • The CLI suggestion is sufficient to resolve the issue, or
  • The error message identifies the missing piece (origin/HEAD) and provides the exact commands needed

Actual behavior

git push -u origin main sets the upstream tracking branch, but chunk sidecar sync still fails:

✗ Error: Could not resolve remote base.
  Suggestion: Push your branch to the remote before syncing.

The same suggestion is shown regardless of how many times it is followed. The underlying issue — that origin/HEAD is not set — is never surfaced.

Resolution

The following three commands are required (not just the suggested push):

git push -u origin <branch>
git fetch origin
git remote set-head origin -a

Verify with:

git symbolic-ref refs/remotes/origin/HEAD
# should print: refs/remotes/origin/<default-branch>

Root cause

MergeBase() in internal/gitutil/gitutil.go resolves the remote base via git merge-base @{upstream} origin/HEAD, falling back to git rev-parse origin/HEAD. Both paths require origin/HEAD to be present.

git clone sets origin/HEAD automatically. git initremote addpush does not — it requires an explicit git fetch + git remote set-head origin -a.

The current suggestion only covers the upstream (git push -u), which is necessary but not sufficient.

Suggested fix

  1. Expand the suggestion to include the full sequence:
    git push -u origin <branch> && git fetch origin && git remote set-head origin -a
    
  2. Add a secondary message when the upstream is already set but the error persists, indicating that origin/HEAD is missing.
  3. Update the skill's Troubleshooting section for Could not resolve remote base to document this git init scenario explicitly.

Workaround

git push -u origin main
git fetch origin
git remote set-head origin -a
chunk sidecar setup   # succeeds

Environment

  • chunk-cli version: 1.2.0 (skill v1.3.0 Troubleshooting section also does not document this)
  • OS: macOS
  • Project created via: git init (not git clone)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions