git-side appears to initialize a fresh side repo using Git’s local default branch, but git-side push always pushes origin main. On systems where the local bare repo starts on master, the first push fails because there is no local main branch yet.
Reproduction
- Install
git-side v0.3.0
- Initialize a fresh side repo in a project:
git-side init --path /some/base/path
- Add at least one file:
- Commit:
git-side commit -m "Initial commit"
- Add a remote:
git-side remote add origin https://github.com/<user>/<repo>.git
- Push:
Actual Behavior
Push fails with:
error: src refspec main does not match any
error: failed to push some refs to '<remote>'
In my case, the local side repo was created on master, not main.
Expected Behavior
git-side push should succeed on a freshly initialized side repo, regardless of the local default branch name.
Root Cause
From the source:
- side repo initialization uses bare
git init without forcing a branch name
- push is hard-coded to
origin main
That means init and push can disagree depending on the Git default branch behavior of the local environment.
Suggested Fix
One of these would fix it:
- Initialize the side repo explicitly on
main
- Push the current branch instead of hard-coding
main
- Detect the branch name dynamically before pushing
Environment
git-side: v0.3.0
- Platform: Linux
arm64
- Observed with a freshly initialized per-project bare side repo
Workaround
I worked around it by renaming the local side repo branch before pushing:
git --git-dir=<side-repo-path> branch -m master main
git --git-dir=<side-repo-path> symbolic-ref HEAD refs/heads/main
git-side push
git-sideappears to initialize a fresh side repo using Git’s local default branch, butgit-side pushalways pushesorigin main. On systems where the local bare repo starts onmaster, the first push fails because there is no localmainbranch yet.Reproduction
git-side v0.3.0git-side commit -m "Initial commit"Actual Behavior
Push fails with:
In my case, the local side repo was created on
master, notmain.Expected Behavior
git-side pushshould succeed on a freshly initialized side repo, regardless of the local default branch name.Root Cause
From the source:
git initwithout forcing a branch nameorigin mainThat means init and push can disagree depending on the Git default branch behavior of the local environment.
Suggested Fix
One of these would fix it:
mainmainEnvironment
git-side:v0.3.0arm64Workaround
I worked around it by renaming the local side repo branch before pushing: