hub: Hub sync exit status 128

git version 2.24.0 hub version 2.13.0

Trying to run hub sync always fails with: exit status 128

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (4 by maintainers)

Most upvoted comments

I’ve also been encountering this issue recently, ever since we changed the default branch in our repository (we use Bitbucket). Editing .git/refs/remotes/origin/HEAD to point to the new default branch name solved the issue for me.

In my case, the remote repository change default branch from master into main. Below command output that hub still tries to call rev-parse to master

# See detailed git commands
HUB_VERBOSE=1 hub sync

Therefore running command git remote set-head origin main save my time from remove & re-clone the repository (ref).

version-bump seemed to point at a non-existent branch in remote not sure how it happened, but force removing badpirate/version-bump allowed the hub sync to succeed. Going to leave open as likely the error could be recognized, or better logged.

Okay, this reproduces regularly and requires manual repair each time. (note I’m on a Gitlab server)

Repro

  1. Locally create a branch, and push to origin
  2. Merge that branch and check the box for “delete branch after merge”
  3. Merge branch -> Deletes the remote branch reference but not local reference
  4. hub sync -> status 128

In this case it seems the rev parse git rev-parse -q refs/heads/badpirate/version-bump refs/remotes/origin/dmz points the removed local branch back at the wrong branch (dmz)… this was a branch we had previously had selected as the root of our tree, but switched back to master in GitLab and dumped the old dmz branch after merging.

I’m going to remove my local repo and re-clone to see if the problem goes away, and I’ll update this task.

I also had this. Also caused by branches that I had locally that were tracking remote branches that no longer existed (due to GitHub “delete branch” feature). Luckily I found this issue for the HUB_VERBOSE=1. Would have helped if hub sync --help referenced that… I was looking for a -v instead.

My apologies @mislav , didn’t grab that command while I was reproducing, I removed the repo and re-cloned and haven’t been seeing the issue any more. Going to leave that as a way to workaround this issue (while kind of a pain) in case anyone else sees it and close.